feat(app): Auth token is now saved after app close

This commit is contained in:
2024-04-15 15:14:15 +03:00
parent ab9227de42
commit 5ba9c15dd2
3 changed files with 8 additions and 2 deletions

View File

@@ -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(