logout
This commit is contained in:
@@ -57,4 +57,21 @@ class AuthRepository implements IAuthRepository {
|
||||
Future<bool> hasToken() async {
|
||||
return await _localDataProvider.hasToken();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<AuthFailure, Unit>> logout() async {
|
||||
try {
|
||||
final result = await _dataProvider.logout();
|
||||
|
||||
if (result.hasError) {
|
||||
return left(result.error!);
|
||||
}
|
||||
|
||||
await _localDataProvider.deleteAllAuth();
|
||||
return right(unit);
|
||||
} catch (e, s) {
|
||||
log('logoutError', name: _logName, error: e, stackTrace: s);
|
||||
return left(const AuthFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user