oidc buttons, depends on server options

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-06-14 15:17:20 +08:00
parent eab67949eb
commit 5a88841ffd
2 changed files with 55 additions and 25 deletions

View File

@@ -109,7 +109,7 @@ class UserModel {
try {
body = jsonDecode(resp.body);
} catch (e) {
print("jsonDecode resp body failed: ${e.toString()}");
print("login: jsonDecode resp body failed: ${e.toString()}");
rethrow;
}
@@ -121,7 +121,7 @@ class UserModel {
try {
loginResponse = LoginResponse.fromJson(body);
} catch (e) {
print("jsonDecode LoginResponse failed: ${e.toString()}");
print("login: jsonDecode LoginResponse failed: ${e.toString()}");
rethrow;
}
@@ -131,4 +131,15 @@ class UserModel {
return loginResponse;
}
static Future<List<dynamic>> queryLoginOptions() async {
final url = await bind.mainGetApiServer();
final resp = await http.get(Uri.parse('$url/api/login-options'));
try {
return jsonDecode(resp.body);
} catch (e) {
print("queryLoginOptions: jsonDecode resp body failed: ${e.toString()}");
return [];
}
}
}