updated packages, did things and maybe finally fixed login issue

This commit is contained in:
Kima
2024-11-12 23:27:14 +01:00
parent 939761695f
commit 2dafe5ed02
12 changed files with 258 additions and 22 deletions

View File

@@ -68,6 +68,8 @@ Future loginAPI({
gradeDelay: 0,
),
role: Role.parent,
accessToken: '',
accessTokenExpire: DateTime.now(),
refreshToken: '',
);
@@ -154,6 +156,8 @@ Future loginAPI({
name: student.name,
student: student,
role: JwtUtils.getRoleFromJWT(res["access_token"])!,
accessToken: res["access_token"],
accessTokenExpire: DateTime.now(),
refreshToken: '',
);
@@ -235,6 +239,15 @@ Future newLoginAPI({
if (res != null) {
if (kDebugMode) {
print(res);
// const splitSize = 1000;
// RegExp exp = RegExp(r"\w{" "$splitSize" "}");
// // String str = "0102031522";
// Iterable<Match> matches = exp.allMatches(res.toString());
// var list = matches.map((m) => m.group(0));
// list.forEach((e) {
// print(e);
// });
}
if (res.containsKey("error")) {
@@ -267,6 +280,9 @@ Future newLoginAPI({
name: student.name,
student: student,
role: role,
accessToken: res["access_token"],
accessTokenExpire:
DateTime.now().add(Duration(seconds: (res["expires_in"] - 30))),
refreshToken: res["refresh_token"],
);