Refactor catching of error from API : check the type of errors

This commit is contained in:
CEC
2022-04-19 16:50:21 +02:00
parent 891ad2c34a
commit e45fcb371c
5 changed files with 69 additions and 35 deletions
+21
View File
@@ -0,0 +1,21 @@
import { z } from "zod";
/*
* WARNING! The original file is in /messages/JsonMessages.
* All other files are automatically copied from this file on container startup / build
*/
export const isErrorApiData = z.object({
type: z.string(),
code: z.string(),
title: z.string(),
subtitle: z.string(),
details: z.string(),
image: z.string(),
urlToRedirect: z.optional(z.nullable(z.string())),
buttonTitle: z.optional(z.nullable(z.string())),
timeToRetry: z.optional(z.nullable(z.bigint())),
canRetryManual: z.optional(z.nullable(z.boolean()))
});
export type ErrorApiData = z.infer<typeof isErrorApiData>;