From 23e773ded267715f4e1003f127bdd9c30f37d0ec Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Mon, 28 Oct 2024 21:44:37 +0800 Subject: [PATCH] specify response type --- src/main/config/override.ts | 3 ++- src/main/config/profile.ts | 6 ++++-- src/main/core/subStoreApi.ts | 4 ++-- src/main/resolve/autoUpdater.ts | 3 ++- src/main/resolve/gistApi.ts | 3 ++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/config/override.ts b/src/main/config/override.ts index bfa29d0..0b9fee0 100644 --- a/src/main/config/override.ts +++ b/src/main/config/override.ts @@ -75,7 +75,8 @@ export async function createOverride(item: Partial): Promise): Promise): Promise { const { useCustomSubStore = false, customSubStoreUrl = '' } = await getAppConfig() const baseUrl = useCustomSubStore ? customSubStoreUrl : `http://127.0.0.1:${subStorePort}` - const res = await axios.get(`${baseUrl}/api/subs`) + const res = await axios.get(`${baseUrl}/api/subs`, { responseType: 'json' }) return res.data.data as ISubStoreSub[] } export async function subStoreCollections(): Promise { const { useCustomSubStore = false, customSubStoreUrl = '' } = await getAppConfig() const baseUrl = useCustomSubStore ? customSubStoreUrl : `http://127.0.0.1:${subStorePort}` - const res = await axios.get(`${baseUrl}/api/collections`) + const res = await axios.get(`${baseUrl}/api/collections`, { responseType: 'json' }) return res.data.data as ISubStoreSub[] } diff --git a/src/main/resolve/autoUpdater.ts b/src/main/resolve/autoUpdater.ts index dc8156b..b1a1cb1 100644 --- a/src/main/resolve/autoUpdater.ts +++ b/src/main/resolve/autoUpdater.ts @@ -20,7 +20,8 @@ export async function checkUpdate(): Promise { protocol: 'http', host: '127.0.0.1', port: mixedPort - } + }, + responseType: 'text' } ) const latest = yaml.parse(res.data, { merge: true }) as IAppVersion diff --git a/src/main/resolve/gistApi.ts b/src/main/resolve/gistApi.ts index 2e30700..0d75186 100644 --- a/src/main/resolve/gistApi.ts +++ b/src/main/resolve/gistApi.ts @@ -20,7 +20,8 @@ async function listGists(token: string): Promise { protocol: 'http', host: '127.0.0.1', port - } + }, + responseType: 'json' }) return res.data as GistInfo[] }