From 4a2ff8fce626262e538c542babf7bc3b8575e06d Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 5 Apr 2024 13:03:29 +0800 Subject: [PATCH] :bug: Fix request bug --- src/scripts/request.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/scripts/request.ts b/src/scripts/request.ts index e5fd02c..24bf599 100644 --- a/src/scripts/request.ts +++ b/src/scripts/request.ts @@ -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