diff --git a/src/store/audio.ts b/src/store/audio.ts index b4b5ded..38952fd 100644 --- a/src/store/audio.ts +++ b/src/store/audio.ts @@ -1,6 +1,6 @@ import { produce } from 'immer'; import { create } from 'zustand'; -import { devtools, persist } from 'zustand/middleware'; +import { devtools, persist, createJSONStorage } from 'zustand/middleware'; import { apiGetSongInfo } from '@/services'; @@ -95,7 +95,7 @@ const useAuioState = create()( }, { name: 'audio', - getStorage: () => localStorage, + storage: createJSONStorage(() => localStorage), }, ), ), diff --git a/src/store/user.ts b/src/store/user.ts index 102ddbc..2659c9f 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -1,7 +1,7 @@ import { produce } from 'immer'; import { setCookie, destroyCookie } from 'nookies'; import { create } from 'zustand'; -import { devtools, persist } from 'zustand/middleware'; +import { devtools, persist, createJSONStorage } from 'zustand/middleware'; import { apiGetMyUserInfo, apiUserLogin, apiUserLogout } from '@/services'; @@ -87,7 +87,7 @@ const useUserStore = create()( }, { name: 'user', - getStorage: () => localStorage, + storage: createJSONStorage(() => localStorage), }, ), ),