Commit fe3dfdf6 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

fix random looping bug with old credentials

parent 1d834abe
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
import '../api/auth_api.dart';
......@@ -20,7 +23,9 @@ class _AuthGuardState extends State<AuthGuard> {
if (_authApi!.user?.credentials?.expiration?.isAfter(DateTime.now()) ?? false) {
return widget.child;
} else {
Future.delayed(const Duration(milliseconds: 200)).then((value) {
Future.delayed(const Duration(milliseconds: 200)).then((value) async {
final basePath = (await getApplicationDocumentsDirectory()).path;
await File('$basePath/credentials').delete();
//Navigator.of(context).popUntil((route) => route.settings.name == '/');
Navigator.of(context).popAndPushNamed('/login');
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment