1 - multi module in Auth select save selected module 2 - add flutter gen for assets builder
34 lines
1.0 KiB
Dart
34 lines
1.0 KiB
Dart
import 'package:rasadyar_app/presentation/routes/app_pages.dart';
|
|
import 'package:rasadyar_auth/data/models/local/module/module_model.dart';
|
|
import 'package:rasadyar_auth/data/services/token_storage_service.dart';
|
|
import 'package:rasadyar_core/core.dart';
|
|
import 'package:rasadyar_inspection/inspection.dart';
|
|
import 'package:rasadyar_livestock/presentation/routes/app_pages.dart';
|
|
|
|
class AuthService extends GetxService {
|
|
var tokenService = Get.find<TokenStorageService>();
|
|
RxBool accessRes = false.obs;
|
|
RxBool refAccessRes = false.obs;
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
|
|
ever(tokenService.accessToken, (callback) {
|
|
accessRes.value = (callback != null);
|
|
});
|
|
|
|
ever(tokenService.refreshToken, (callback) {
|
|
refAccessRes.value = (callback != null);
|
|
});
|
|
|
|
everAll([accessRes, refAccessRes], (_) {
|
|
if (accessRes.value && refAccessRes.value) {
|
|
var targetPage = getTargetPage(tokenService.appModule.value);
|
|
Get.offAndToNamed(targetPage);
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|