mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
getting spaces and rooms from api {null checks}
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:syncrow_app/features/auth/model/token.dart';
|
||||
|
||||
class HTTPInterceptor extends InterceptorsWrapper {
|
||||
// @override
|
||||
@ -11,9 +12,9 @@ class HTTPInterceptor extends InterceptorsWrapper {
|
||||
@override
|
||||
void onRequest(
|
||||
RequestOptions options, RequestInterceptorHandler handler) async {
|
||||
//pass the token from the flutter secure storage to the request header
|
||||
|
||||
options.headers['Authorization'] = 'Bearer ${AuthCubit.token.accessToken}';
|
||||
var storage = FlutterSecureStorage();
|
||||
var token = await storage.read(key: Token.loginAccessTokenKey);
|
||||
options.headers['Authorization'] = 'Bearer $token';
|
||||
|
||||
super.onRequest(options, handler);
|
||||
}
|
||||
|
Reference in New Issue
Block a user