forked from eatvio/eatvio_app
feat(app): Auth token is now saved after app close
This commit is contained in:
@@ -13,7 +13,7 @@ import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart';
|
||||
import 'package:eatvio_app/widgets/custom_edit_drop_down.dart';
|
||||
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
|
||||
import 'package:eatvio_app/widgets/custom_scale_element.dart';
|
||||
import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
|
||||
//import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:eatvio_app/presentation/auth/auth_screen/auth_screen.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '/core/app_export.dart';
|
||||
@@ -23,6 +24,11 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
|
||||
try {
|
||||
final box = await Hive.openBox('token');
|
||||
final token = box.get('token');
|
||||
if (token == null) {
|
||||
NavigatorService.popAndPushNamed(
|
||||
AppRoutes.authScreen,
|
||||
); // Если токен есть, запускаем приложение
|
||||
}
|
||||
//final token =
|
||||
// "9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a";
|
||||
final response = await http.get(
|
||||
|
||||
@@ -17,7 +17,7 @@ class SplashBloc extends Bloc<SplashEvent, SplashState> {
|
||||
) async {
|
||||
Future.delayed(const Duration(milliseconds: 3000), () {
|
||||
NavigatorService.popAndPushNamed(
|
||||
AppRoutes.authScreen,
|
||||
AppRoutes.myProfile,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user