feat: Add splash screen and update routing to include it
This commit is contained in:
@@ -69,10 +69,25 @@ class AuthService extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<dynamic> _httpGet(String path) async {
|
||||
if (token == null) return null;
|
||||
final res = await http.get(Uri.parse('$_base$path'), headers: {'Authorization': 'Bearer $token'});
|
||||
if (res.statusCode == 200) return jsonDecode(res.body);
|
||||
return null;
|
||||
if (token == null) {
|
||||
if (kDebugMode) print('[AuthService] _httpGet called without token for $path');
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
final res = await http.get(Uri.parse('$_base$path'), headers: {'Authorization': 'Bearer $token'});
|
||||
if (res.statusCode == 200) {
|
||||
return jsonDecode(res.body);
|
||||
} else {
|
||||
if (kDebugMode) {
|
||||
print('[AuthService] GET $path -> ${res.statusCode}');
|
||||
print('[AuthService] response body: ${res.body}');
|
||||
}
|
||||
throw Exception('HTTP ${res.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
if (kDebugMode) print('[AuthService] _httpGet error: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _loadToken() async {
|
||||
|
||||
Reference in New Issue
Block a user