add login

This commit is contained in:
jyuesong
2022-01-12 17:44:03 +08:00
parent 94210d246c
commit 5d7fc83f91
15 changed files with 726 additions and 57 deletions

View File

@@ -0,0 +1,13 @@
import 'package:dio/dio.dart';
import 'package:qinglong_app/main.dart';
class TokenInterceptor extends Interceptor {
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
if (userInfoViewModel.token != null) {
options.headers["Authorization"] = "Bearer " + userInfoViewModel.token!;
}
options.queryParameters["t"] = DateTime.now().millisecondsSinceEpoch;
return handler.next(options);
}
}