fix: code-review findings — error handling, null safety, persist settings, auth header

This commit is contained in:
Dustin
2026-08-01 15:09:48 +02:00
parent 669a02304e
commit 4a05c76199
4 changed files with 40 additions and 9 deletions
+9 -4
View File
@@ -21,10 +21,15 @@ class AuthService {
String? get token => _token;
/// Auth-Header für API-Requests
Map<String, String> get authHeader => {
'Authorization': 'Bearer ${_token ?? ''}',
'Content-Type': 'application/json',
};
Map<String, String> get authHeader {
final headers = <String, String>{
'Content-Type': 'application/json',
};
if (_token != null && _token!.isNotEmpty) {
headers['Authorization'] = 'Bearer $_token';
}
return headers;
}
/// Lädt gespeicherten Token beim App-Start
Future<void> initialisieren() async {