Fix parsing issues in personal profile

This commit is contained in:
Nutcake 2023-05-16 16:40:43 +02:00
parent 561c5eb670
commit b805157f89
2 changed files with 9 additions and 9 deletions

View file

@ -142,7 +142,7 @@ class ApiClient {
headers ??= {}; headers ??= {};
headers.addAll(authorizationHeader); headers.addAll(authorizationHeader);
final response = await http.get(buildFullUri(path), headers: headers); final response = await http.get(buildFullUri(path), headers: headers);
_logger.info("GET $path => ${response.statusCode}"); _logger.info("GET $path => ${response.statusCode}${response.statusCode >= 300 ? ": ${response.body}" : ""}");
return response; return response;
} }
@ -151,7 +151,7 @@ class ApiClient {
headers["Content-Type"] = "application/json"; headers["Content-Type"] = "application/json";
headers.addAll(authorizationHeader); headers.addAll(authorizationHeader);
final response = await http.post(buildFullUri(path), headers: headers, body: body); final response = await http.post(buildFullUri(path), headers: headers, body: body);
_logger.info("PST $path => ${response.statusCode}"); _logger.info("PST $path => ${response.statusCode}${response.statusCode >= 300 ? ": ${response.body}" : ""}");
return response; return response;
} }
@ -160,7 +160,7 @@ class ApiClient {
headers["Content-Type"] = "application/json"; headers["Content-Type"] = "application/json";
headers.addAll(authorizationHeader); headers.addAll(authorizationHeader);
final response = await http.put(buildFullUri(path), headers: headers, body: body); final response = await http.put(buildFullUri(path), headers: headers, body: body);
_logger.info("PUT $path => ${response.statusCode}"); _logger.info("PUT $path => ${response.statusCode}${response.statusCode >= 300 ? ": ${response.body}" : ""}");
return response; return response;
} }
@ -168,7 +168,7 @@ class ApiClient {
headers ??= {}; headers ??= {};
headers.addAll(authorizationHeader); headers.addAll(authorizationHeader);
final response = await http.delete(buildFullUri(path), headers: headers); final response = await http.delete(buildFullUri(path), headers: headers);
_logger.info("DEL $path => ${response.statusCode}"); _logger.info("DEL $path => ${response.statusCode}${response.statusCode >= 300 ? ": ${response.body}" : ""}");
return response; return response;
} }
@ -177,7 +177,7 @@ class ApiClient {
headers["Content-Type"] = "application/json"; headers["Content-Type"] = "application/json";
headers.addAll(authorizationHeader); headers.addAll(authorizationHeader);
final response = await http.patch(buildFullUri(path), headers: headers, body: body); final response = await http.patch(buildFullUri(path), headers: headers, body: body);
_logger.info("PAT $path => ${response.statusCode}"); _logger.info("PAT $path => ${response.statusCode}${response.statusCode >= 300 ? ": ${response.body}" : ""}");
return response; return response;
} }
} }

View file

@ -53,10 +53,10 @@ class StorageQuotas {
factory StorageQuotas.fromMap(Map map) { factory StorageQuotas.fromMap(Map map) {
return StorageQuotas( return StorageQuotas(
id: map["id"], id: map["id"] ?? "",
bytes: map["bytes"], bytes: map["bytes"] ?? 0,
addedOn: DateTime.parse(map["addedOn"]), addedOn: DateTime.tryParse(map["addedOn"]) ?? DateTime.fromMillisecondsSinceEpoch(0),
expiresOn: DateTime.parse(map["expiresOn"]), expiresOn: DateTime.tryParse(map["expiresOn"]) ?? DateTime.fromMillisecondsSinceEpoch(0),
giftedByUserId: map["giftedByUserId"] ?? "", giftedByUserId: map["giftedByUserId"] ?? "",
); );
} }