feat: Add splash screen and update routing to include it

This commit is contained in:
2025-08-20 23:05:21 +02:00
parent b1e5efb672
commit 592e79a375
7 changed files with 266 additions and 35 deletions

View File

@@ -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 {