getting spaces and rooms from api {null checks}

This commit is contained in:
Mohammad Salameh
2024-03-13 13:52:22 +03:00
parent 0f3cc453ce
commit 024f15728b
26 changed files with 390 additions and 266 deletions

View File

@ -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);
}