diff --git a/lib/controller/stillbox.dart b/lib/controller/stillbox.dart index 9930727..aee9727 100644 --- a/lib/controller/stillbox.dart +++ b/lib/controller/stillbox.dart @@ -70,6 +70,7 @@ class Stillbox extends ChangeNotifier { ); if (response.statusCode == 200) { String? token = channel.updateCookie(response); + print('token is $token'); storage.setKey('baseURL', uri); if (!kIsWeb && token != null) { storage.setKey('token', token); @@ -98,10 +99,12 @@ class Stillbox extends ChangeNotifier { String? storedToken = await storage.getKey('token'); late String? storedUri; storedUri = await storage.getKey('baseURL'); - if (storedToken == null || storedUri == null) { + if ((!kIsWeb && storedToken == null) || storedUri == null) { throw (BadAuthException); } - channel.setCookie(storedToken); + if (!kIsWeb) { + channel.setCookie(storedToken!); + } baseUri = Uri.parse(storedUri); setUris(); } diff --git a/lib/controller/stillbox_none.dart b/lib/controller/stillbox_none.dart index a682223..63524c8 100644 --- a/lib/controller/stillbox_none.dart +++ b/lib/controller/stillbox_none.dart @@ -6,7 +6,7 @@ class Storer { return null; } - void setKey(String key, String value) { + Future setKey(String key, String value) async { return; } } diff --git a/lib/controller/stillbox_web.dart b/lib/controller/stillbox_web.dart index 62ba41f..e4fbcd9 100644 --- a/lib/controller/stillbox_web.dart +++ b/lib/controller/stillbox_web.dart @@ -7,7 +7,7 @@ class Storer { return window.localStorage[key]; } - void setKey(String key, String value) { + Future setKey(String key, String value) async { window.localStorage[key] = value; } } diff --git a/lib/views/login.dart b/lib/views/login.dart index 7495cea..9f51c07 100644 --- a/lib/views/login.dart +++ b/lib/views/login.dart @@ -98,6 +98,7 @@ class _LoginState extends State { uriController.text, userController.text, passwordController.text); + print("result is $result"); if (context.mounted && result == true) { Navigator.pushReplacement( context,