mirror of
https://github.com/amigan/calls.git
synced 2024-11-21 04:19:47 -05:00
fix web load
This commit is contained in:
parent
596c9863ef
commit
d87b497e30
4 changed files with 8 additions and 4 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ class Storer {
|
|||
return null;
|
||||
}
|
||||
|
||||
void setKey(String key, String value) {
|
||||
Future<void> setKey(String key, String value) async {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class Storer {
|
|||
return window.localStorage[key];
|
||||
}
|
||||
|
||||
void setKey(String key, String value) {
|
||||
Future<void> setKey(String key, String value) async {
|
||||
window.localStorage[key] = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@ class _LoginState extends State<Login> {
|
|||
uriController.text,
|
||||
userController.text,
|
||||
passwordController.text);
|
||||
print("result is $result");
|
||||
if (context.mounted && result == true) {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
|
|
Loading…
Reference in a new issue