diff --git a/src/utils/functions/statusPopsApi.ts b/src/utils/functions/statusPopsApi.ts new file mode 100644 index 0000000..6e9891e --- /dev/null +++ b/src/utils/functions/statusPopsApi.ts @@ -0,0 +1,13 @@ +import { ofetch } from 'ofetch'; + +const STATUS = "https://gateway.davaocity.gov.ph/api/pops/statusOP.ashx?oprefid=" + +export default async (application: string) => { + try { + const fetch = await ofetch(STATUS + application, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] }) + const result = fetch + return result + } catch { + return null + } +}