This commit is contained in:
wgh136
2024-05-15 11:16:05 +08:00
parent 8f0e44216a
commit 2826f9f592
5 changed files with 263 additions and 26 deletions

View File

@@ -106,7 +106,14 @@ class Network {
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
validateStatus: (i) => true,
headers: headers));
if(res.statusCode != 200) {
var data = res.data ?? "";
if(data.contains("Invalid refresh token")) {
throw "Failed to refresh token. Plaese logout and re-login";
}
}
var account = Account.fromJson(json.decode(res.data!));
appdata.account = account;
appdata.writeData();