diff --git a/src/utils/functions/getApi.ts b/src/utils/functions/getApi.ts index 30b4523..c902370 100644 --- a/src/utils/functions/getApi.ts +++ b/src/utils/functions/getApi.ts @@ -6,9 +6,9 @@ export default async (api: string, value?: any) => { try { let fetch if (!value) { - fetch = await ofetch(API + api, { parseResponse: JSON.parse }) + fetch = await ofetch(API + api, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] }) } else { - fetch = await ofetch(API + `${api}/${value}`, { parseResponse: JSON.parse }) + fetch = await ofetch(API + `${api}/${value}`, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] }) } const result = fetch.result return result diff --git a/src/utils/functions/getApiMulti.ts b/src/utils/functions/getApiMulti.ts index 69d1b3e..c595379 100644 --- a/src/utils/functions/getApiMulti.ts +++ b/src/utils/functions/getApiMulti.ts @@ -6,9 +6,9 @@ export default async (api: string, value?: any) => { let fetch try { if (!value) { - fetch = await ofetch(API + api, { parseResponse: JSON.parse }) + fetch = await ofetch(API + api, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] }) } else { - fetch = await ofetch(API + `${api}/${value}`, { parseResponse: JSON.parse }) + fetch = await ofetch(API + `${api}/${value}`, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] }) } return fetch