fix: handled api error responses

This commit is contained in:
Riccardo
2023-12-17 19:17:32 +01:00
parent a9b2c94cff
commit 5118f55c0c
7 changed files with 27 additions and 7 deletions

View File

@@ -31,7 +31,13 @@ export default function Confirmation() {
if (!res.ok) {
router.push('/');
}
const response: z.infer<typeof ResponseSchema> = await res.json();
if (!response.success) {
router.push('/');
}
return response;
})
.then(response => {