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) {
|
if (response.statusCode == 200) {
|
||||||
String? token = channel.updateCookie(response);
|
String? token = channel.updateCookie(response);
|
||||||
|
print('token is $token');
|
||||||
storage.setKey('baseURL', uri);
|
storage.setKey('baseURL', uri);
|
||||||
if (!kIsWeb && token != null) {
|
if (!kIsWeb && token != null) {
|
||||||
storage.setKey('token', token);
|
storage.setKey('token', token);
|
||||||
|
@ -98,10 +99,12 @@ class Stillbox extends ChangeNotifier {
|
||||||
String? storedToken = await storage.getKey('token');
|
String? storedToken = await storage.getKey('token');
|
||||||
late String? storedUri;
|
late String? storedUri;
|
||||||
storedUri = await storage.getKey('baseURL');
|
storedUri = await storage.getKey('baseURL');
|
||||||
if (storedToken == null || storedUri == null) {
|
if ((!kIsWeb && storedToken == null) || storedUri == null) {
|
||||||
throw (BadAuthException);
|
throw (BadAuthException);
|
||||||
}
|
}
|
||||||
channel.setCookie(storedToken);
|
if (!kIsWeb) {
|
||||||
|
channel.setCookie(storedToken!);
|
||||||
|
}
|
||||||
baseUri = Uri.parse(storedUri);
|
baseUri = Uri.parse(storedUri);
|
||||||
setUris();
|
setUris();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Storer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setKey(String key, String value) {
|
Future<void> setKey(String key, String value) async {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Storer {
|
||||||
return window.localStorage[key];
|
return window.localStorage[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
void setKey(String key, String value) {
|
Future<void> setKey(String key, String value) async {
|
||||||
window.localStorage[key] = value;
|
window.localStorage[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,7 @@ class _LoginState extends State<Login> {
|
||||||
uriController.text,
|
uriController.text,
|
||||||
userController.text,
|
userController.text,
|
||||||
passwordController.text);
|
passwordController.text);
|
||||||
|
print("result is $result");
|
||||||
if (context.mounted && result == true) {
|
if (context.mounted && result == true) {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
context,
|
context,
|
||||||
|
|
Loading…
Reference in a new issue