fix: code-review findings — error handling, null safety, persist settings, auth header
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user