feat: Implement the home screen with new UI components and assets, and refine authentication screens and routing.
This commit is contained in:
@@ -52,6 +52,32 @@ class AuthRepository {
|
||||
}
|
||||
}
|
||||
|
||||
Future<UserModel> getMe() async {
|
||||
try {
|
||||
final response = await _dio.get(ApiConstants.authMe);
|
||||
final data = response.data['data'] as Map<String, dynamic>;
|
||||
return UserModel.fromJson(data);
|
||||
} on DioException catch (e) {
|
||||
if (e.error is ApiException) {
|
||||
throw e.error as ApiException;
|
||||
}
|
||||
throw ApiException(
|
||||
message: e.message ?? 'Failed to fetch user',
|
||||
statusCode: e.response?.statusCode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> logout() async {
|
||||
try {
|
||||
await _dio.post(ApiConstants.authLogout);
|
||||
} catch (_) {
|
||||
// Ignore logout API errors — still clear local tokens
|
||||
} finally {
|
||||
await SecureStorage.clearTokens();
|
||||
}
|
||||
}
|
||||
|
||||
Future<UserModel> register(RegisterRequest request) async {
|
||||
try {
|
||||
final response = await _dio.post(
|
||||
|
||||
Reference in New Issue
Block a user