mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
Transfer repository from Gitlab
This commit is contained in:
parent
af2efbdbbd
commit
568cc243f0
177 changed files with 13300 additions and 0 deletions
17
mobile/lib/utils/dio_http_interceptor.dart
Normal file
17
mobile/lib/utils/dio_http_interceptor.dart
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:immich_mobile/constants/hive_box.dart';
|
||||
|
||||
class AuthenticatedRequestInterceptor extends Interceptor {
|
||||
@override
|
||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||
// debugPrint('REQUEST[${options.method}] => PATH: ${options.path}');
|
||||
|
||||
var box = Hive.box(userInfoBox);
|
||||
|
||||
options.headers["Authorization"] = "Bearer ${box.get(accessTokenKey)}";
|
||||
options.responseType = ResponseType.plain;
|
||||
return super.onRequest(options, handler);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue