Commit 0a1c70c3 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

fix put content

parent 4c3fd804
......@@ -255,14 +255,13 @@ class AdminsBloc extends Bloc<AdminsEvent, AdminsState> {
_log.fine('_updateAdmin: run for ${admin.toMap}');
final data = admin.toMap;
data.remove('id');
data.removeWhere((key, value) => value == null);
data.removeWhere((key, value) => key == 'id');
return await _client
.put(
Uri.parse('https://astaprint.upb.de/api/v1/admin/admins/${admin.id}'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: json.encode(data),
)
......
......@@ -43,6 +43,7 @@ class Admin {
};
Admin copyWith({
int id,
String firstName,
String lastName,
String login,
......@@ -51,7 +52,7 @@ class Admin {
DateTime expires,
}) =>
Admin(
id: id,
id: id ?? this.id,
firstName: firstName ?? this.firstName,
lastName: lastName ?? this.lastName,
login: login ?? this.login,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment