bio login
This commit is contained in:
1 parent
6acec998bc
commit
0ba83858fe
12 files changed
+522
-80
No files matched your search
@@ -29,7 +29,8 @@ class ApiService {
|
||||
if (response.statusCode == 200) {
|
||||
final data = jsonDecode(response.body);
|
||||
_token = data['access_token']; // salva il token in memoria
|
||||
return _token!;
|
||||
AuthToken.instance.saveToken(_token!);
|
||||
return '${response.statusCode}';
|
||||
} else {
|
||||
throw Exception(
|
||||
'Login fallito: ${response.statusCode} - ${response.body}');
|
||||
@@ -37,7 +38,7 @@ class ApiService {
|
||||
}
|
||||
|
||||
static Future<dynamic> checkLogin() async {
|
||||
final token = auth_token().token;
|
||||
final token = AuthToken.instance.token;
|
||||
if (token == null) {
|
||||
throw Exception('Token non disponibile. Effettua il login prima.');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user