Smail/frontend/src/utils/publicRecoveryHttp.js
smail 461d8b2237
Some checks are pending
Security Checks / security (push) Waiting to run
修复认证繁忙时前端恢复重试并补齐远程测试
2026-09-17 12:33:25 +08:00

28 lines
575 B
JavaScript

const publicRecoveryAPIBase = '/rest/api/recovery'
export async function postPublicRecovery(endpoint, payload) {
const response = await fetch(`${publicRecoveryAPIBase}/${endpoint}`, {
method: 'POST',
credentials: 'omit',
cache: 'no-store',
referrerPolicy: 'no-referrer',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
})
let result = null
try {
result = await response.json()
} catch {
result = null
}
return {
ok: response.ok,
status: response.status,
data: result
}
}