From 5b1b1d88fce9fdc021f627a25eeedeb6613d04dd Mon Sep 17 00:00:00 2001 From: Innei Date: Wed, 19 Jun 2024 19:37:08 +0800 Subject: [PATCH] fix: cleanup Signed-off-by: Innei --- src/renderer/src/lib/api-fetch.ts | 3 +-- src/renderer/src/store/utils/local.ts | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/lib/api-fetch.ts b/src/renderer/src/lib/api-fetch.ts index c4f487f91..9e88c261a 100644 --- a/src/renderer/src/lib/api-fetch.ts +++ b/src/renderer/src/lib/api-fetch.ts @@ -7,6 +7,7 @@ import { ofetch } from "ofetch" export abstract class RequestError extends Error { name = "RequestError" } +const csrfToken = await getCsrfToken() export const apiFetch = ofetch.create({ baseURL: import.meta.env.VITE_API_URL, @@ -14,8 +15,6 @@ export const apiFetch = ofetch.create({ retry: false, onRequest: async ({ options }) => { if (options.method && options.method.toLowerCase() !== "get") { - const csrfToken = await getCsrfToken() - if (typeof options.body === "string") { options.body = JSON.parse(options.body) } diff --git a/src/renderer/src/store/utils/local.ts b/src/renderer/src/store/utils/local.ts index 96163980a..eb304c4ae 100644 --- a/src/renderer/src/store/utils/local.ts +++ b/src/renderer/src/store/utils/local.ts @@ -1,11 +1,12 @@ import { entryActions } from "../entry/store" +import { feedActions } from "../feed" import { subscriptionActions } from "../subscription" import { uiActions } from "../ui" import { unreadActions } from "../unread" export const clearLocalPersistStoreData = () => { // All clear and reset method will aggregate here - [entryActions, subscriptionActions, unreadActions, uiActions].forEach( + [entryActions, subscriptionActions, unreadActions, uiActions, feedActions].forEach( (actions) => { actions.clear() },