import 'dart:async'; import 'package:flustars/flustars.dart'; import 'package:get/get_connect/http/src/request/request.dart'; import 'package:ftrecruiter/comm/constants/sp_constant.dart'; import 'package:ftrecruiter/comm/utils/device_utils.dart'; //自动添加Token,自动刷新Token FutureOr authInterceptor(Request request) async { final token = SpUtil.getString(SPConstant.SP_KEY_TOKEN); if (!TextUtil.isEmpty(token)) { request.headers['Authorization'] = 'bearer$token'; } if (!Device.isWeb) { request.headers['User-Agent'] = 'Mozilla/5.0'; } return request; }