Updated
This commit is contained in:
parent
d61b8b7bd8
commit
46783c4f38
57 changed files with 4178 additions and 5992 deletions
|
|
@ -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]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue