This commit is contained in:
Patrick Alvin Alcala 2025-11-24 16:33:12 +08:00
parent fe90f5988a
commit 499e1530cc
9 changed files with 195 additions and 9 deletions

View file

@ -1,12 +1,14 @@
import { encryptRsa } from '../../scripts'
import { $backendUrl } from 'configs/config.api'
import { $tokenExpiration, $tokenName } from 'configs/config.security'
import dayjs from 'dayjs'
import { ofetch } from 'ofetch'
import { $backendUrl, $requestRetries, $requestRetryCodes } from '../../../../configs/config.api'
import { $tokenExpiration, $tokenName } from '../../../../configs/config.security'
import { encryptRsa } from '../../scripts'
const URL = $backendUrl.get()
const TOKEN_NAME = $tokenName.get()
const TOKEN_EXPIRATION = $tokenExpiration.get()
const RETRY = $requestRetries.get()
const CODES = $requestRetryCodes.get()
export default async (api: string, body: Object) => {
const today = new Date()
@ -22,9 +24,9 @@ export default async (api: string, body: Object) => {
'Cache-Control': 'no-cache',
'Dasig-Token': hash,
},
retry: 3,
retry: RETRY,
retryDelay: 500,
retryStatusCodes: [400, 404, 405, 500, 502],
retryStatusCodes: CODES,
method: 'POST',
body: body,
})