fix: token
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -10,6 +11,7 @@ import '../auth_dtos.dart';
|
||||
@injectable
|
||||
class AuthLocalDataProvider {
|
||||
final SharedPreferences _sharedPreferences;
|
||||
final String _logName = 'AuthLocalDataProvider';
|
||||
|
||||
AuthLocalDataProvider(this._sharedPreferences);
|
||||
|
||||
@@ -48,7 +50,11 @@ class AuthLocalDataProvider {
|
||||
}
|
||||
|
||||
Future<void> deleteAllAuth() async {
|
||||
await _sharedPreferences.remove(LocalStorageKey.token);
|
||||
await _sharedPreferences.remove(LocalStorageKey.user);
|
||||
try {
|
||||
await _sharedPreferences.remove(LocalStorageKey.token);
|
||||
await _sharedPreferences.remove(LocalStorageKey.user);
|
||||
} catch (e) {
|
||||
log('deleteAllAuthError', name: _logName, error: e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:data_channel/data_channel.dart';
|
||||
|
||||
import '../../../common/api/api_client.dart';
|
||||
import '../../../common/api/api_failure.dart';
|
||||
import '../../../common/function/app_function.dart';
|
||||
import '../../../common/url/api_path.dart';
|
||||
import '../../../domain/auth/auth.dart';
|
||||
import '../auth_dtos.dart';
|
||||
@@ -45,7 +46,7 @@ class AuthRemoteDataProvider {
|
||||
|
||||
Future<DC<AuthFailure, Unit>> logout() async {
|
||||
try {
|
||||
await _apiClient.post(ApiPath.logout);
|
||||
await _apiClient.post(ApiPath.logout, headers: getAuthorizationHeader());
|
||||
return DC.data(unit);
|
||||
} on ApiFailure catch (e, s) {
|
||||
log('login', name: _logName, error: e, stackTrace: s);
|
||||
|
||||
Reference in New Issue
Block a user