mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-24 19:17:55 +00:00
Fixed logout issue
This commit is contained in:
@@ -7,16 +7,26 @@ import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
||||
|
||||
class SplashView extends StatelessWidget {
|
||||
class SplashView extends StatefulWidget {
|
||||
const SplashView({super.key});
|
||||
|
||||
@override
|
||||
State<SplashView> createState() => _SplashViewState();
|
||||
}
|
||||
|
||||
class _SplashViewState extends State<SplashView> {
|
||||
@override
|
||||
void initState() {
|
||||
AuthCubit.get(context).getTokenAndValidate();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocConsumer<AuthCubit, AuthState>(
|
||||
listener: (context, state) {
|
||||
if (state is AuthTokenSuccess) {
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
context, Routes.homeRoute, (route) => false);
|
||||
Navigator.pushNamedAndRemoveUntil(context, Routes.homeRoute, (route) => false);
|
||||
} else if (state is AuthTokenError) {
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
Navigator.pushReplacement(
|
||||
|
||||
Reference in New Issue
Block a user