feat: Implement email verification flow for user registration, update API base URL, and refine agent search screen UI.
This commit is contained in:
@@ -130,7 +130,9 @@ class AuthRepository {
|
||||
}
|
||||
}
|
||||
|
||||
Future<UserModel> register(RegisterRequest request) async {
|
||||
/// Register returns { message, user } — no tokens.
|
||||
/// The user must verify their email before logging in.
|
||||
Future<Map<String, dynamic>> register(RegisterRequest request) async {
|
||||
try {
|
||||
final response = await _dio.post(
|
||||
ApiConstants.authRegister,
|
||||
@@ -138,14 +140,7 @@ class AuthRepository {
|
||||
);
|
||||
|
||||
final data = response.data['data'] as Map<String, dynamic>;
|
||||
final authResponse = AuthResponse.fromJson(data);
|
||||
|
||||
await SecureStorage.saveTokens(
|
||||
accessToken: authResponse.accessToken,
|
||||
refreshToken: authResponse.refreshToken,
|
||||
);
|
||||
|
||||
return authResponse.user;
|
||||
return data;
|
||||
} on DioException catch (e) {
|
||||
if (e.error is ApiException) {
|
||||
throw e.error as ApiException;
|
||||
|
||||
Reference in New Issue
Block a user