Formatting changes

This commit is contained in:
Aaron William Po
2023-02-20 09:09:45 -05:00
parent d50ce7497b
commit 4cd2ab476f
14 changed files with 61 additions and 109 deletions

View File

@@ -7,21 +7,21 @@ const sendCreateBeerPostRequest = async (
) => {
const response = await fetch('/api/beers/create', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const json = await response.json();
const parsed = APIResponseValidationSchema.safeParse(json);
if (!parsed.success) {
throw new Error('Invalid API response');
}
const { payload } = parsed.data;
const { payload, success, message } = parsed.data;
if (!success) {
throw new Error(message);
}
if (
!(