chnages has been made
This commit is contained in:
@@ -19,10 +19,14 @@ class ApiClient {
|
||||
dio.interceptors.add(
|
||||
InterceptorsWrapper(
|
||||
onRequest: (options, handler) async {
|
||||
// Get token from SharedPreferences
|
||||
final token = sharedPreferences?.getString(_tokenKey);
|
||||
if (token != null && token.isNotEmpty) {
|
||||
options.headers['Authorization'] = 'Bearer $token';
|
||||
// Skip auth if the request explicitly opts out
|
||||
final skipAuth = options.extra['skipAuth'] == true;
|
||||
if (!skipAuth) {
|
||||
// Get token from SharedPreferences
|
||||
final token = sharedPreferences?.getString(_tokenKey);
|
||||
if (token != null && token.isNotEmpty) {
|
||||
options.headers['Authorization'] = 'Bearer $token';
|
||||
}
|
||||
}
|
||||
return handler.next(options);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user