🐛 Fix request bug

This commit is contained in:
LittleSheep 2024-04-05 13:03:29 +08:00
parent 3a42c58013
commit 4a2ff8fce6

View File

@ -4,7 +4,7 @@ import { Preferences } from "@capacitor/preferences"
const serviceMap: { [id: string]: string } = {
interactive: "https://co.solsynth.dev",
identity: "https://id.solsynth.dev",
messaging: "https://im.solsynth.dev",
messaging: "https://im.solsynth.dev"
}
export async function request(service: string, input: string, init?: RequestInit, noRetry?: boolean) {
@ -36,9 +36,10 @@ export async function request(service: string, input: string, init?: RequestInit
}
console.info("[REQUEST] Auth context has been refreshed.")
return await request(service, input, Object.assign(init as any, {
headers: { Authorization: `Bearer ${await getAtk()}` }
}), true)
return await request(service, input, {
...init,
headers: { ...init?.headers, Authorization: `Bearer ${await getAtk()}` }
}, true)
}
return res