feat: logout

This commit is contained in:
efrilm
2025-08-16 19:29:21 +07:00
parent e1bde24a83
commit f138e1dcc9
12 changed files with 532 additions and 78 deletions
@@ -58,4 +58,20 @@ class AuthRepository implements IAuthRepository {
Future<bool> hasToken() async {
return await _localDataProvider.hasToken();
}
@override
Future<Either<AuthFailure, Unit>> logout() async {
try {
final result = await _remoteDataProvider.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());
}
}
}