This commit is contained in:
Patrick Alvin Alcala 2025-11-26 10:56:07 +08:00
parent d61b8b7bd8
commit 46783c4f38
57 changed files with 4178 additions and 5992 deletions

View file

@ -1,25 +0,0 @@
import { ofetch } from 'ofetch'
import { $backendUrl, $requestRetries, $requestRetryCodes } from '../../../../configs/config.api'
const URL = $backendUrl.get()
const RETRY = $requestRetries.get()
const CODES = $requestRetryCodes.get()
export default async (api: string, value?: any, value2?: any) => {
try {
let fetch
if (!value2) {
if (!value) {
fetch = await ofetch(URL + api, { parseResponse: JSON.parse, retry: RETRY, retryDelay: 500, retryStatusCodes: CODES })
} else {
fetch = await ofetch(URL + `${api}/${value}/fetch-data`, { parseResponse: JSON.parse, retry: RETRY, retryDelay: 500, retryStatusCodes: CODES })
}
} else {
fetch = await ofetch(URL + `${api}/${value}/${value2}/fetch-data`, { parseResponse: JSON.parse, retry: RETRY, retryDelay: 500, retryStatusCodes: CODES })
}
const result = fetch
return [result, null]
} catch (error) {
return [[], error]
}
}