remove unused logout and user profile methods from AuthService
This commit is contained in:
parent
faf478a7b0
commit
7c9e089c62
@ -1,10 +1,7 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../../features/auth/models/auth_token.dart';
|
||||
import '../../features/auth/models/auth_credentials.dart';
|
||||
import '../../data/models/user.dart';
|
||||
import '../../core/errors/exceptions.dart';
|
||||
|
||||
|
||||
@ -54,30 +51,4 @@ class AuthService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> logout(String refreshToken) async {
|
||||
try {
|
||||
await _dio.post(
|
||||
'/auth/logout',
|
||||
data: {'refresh_token': refreshToken},
|
||||
);
|
||||
} catch (e) {
|
||||
// We might want to just log this error rather than throwing,
|
||||
// as logout should succeed even if the server call fails
|
||||
log('Logout error: ${e.toString()}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<User> getUserProfile() async {
|
||||
try {
|
||||
final response = await _dio.get('/auth/profile');
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return User.fromJson(response.data);
|
||||
} else {
|
||||
throw AuthException('Failed to get user profile');
|
||||
}
|
||||
} catch (e) {
|
||||
throw AuthException('Error fetching user profile: ${e.toString()}');
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user