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.addAll(authorizationHeader);
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;
}
@ -151,7 +151,7 @@ class ApiClient {
headers["Content-Type"] = "application/json";
headers.addAll(authorizationHeader);
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;
}
@ -160,7 +160,7 @@ class ApiClient {
headers["Content-Type"] = "application/json";
headers.addAll(authorizationHeader);
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;
}
@ -168,7 +168,7 @@ class ApiClient {
headers ??= {};
headers.addAll(authorizationHeader);
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;
}
@ -177,7 +177,7 @@ class ApiClient {
headers["Content-Type"] = "application/json";
headers.addAll(authorizationHeader);
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;
}
}

View file

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