fix(zustand): Upgrade to storage.

mack-mac
mackt 7 months ago
parent 8e0bc75ad9
commit 6098dfb2a1

@ -1,6 +1,6 @@
import { produce } from 'immer'; import { produce } from 'immer';
import { create } from 'zustand'; import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware'; import { devtools, persist, createJSONStorage } from 'zustand/middleware';
import { apiGetSongInfo } from '@/services'; import { apiGetSongInfo } from '@/services';
@ -95,7 +95,7 @@ const useAuioState = create<AuioState>()(
}, },
{ {
name: 'audio', name: 'audio',
getStorage: () => localStorage, storage: createJSONStorage(() => localStorage),
}, },
), ),
), ),

@ -1,7 +1,7 @@
import { produce } from 'immer'; import { produce } from 'immer';
import { setCookie, destroyCookie } from 'nookies'; import { setCookie, destroyCookie } from 'nookies';
import { create } from 'zustand'; import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware'; import { devtools, persist, createJSONStorage } from 'zustand/middleware';
import { apiGetMyUserInfo, apiUserLogin, apiUserLogout } from '@/services'; import { apiGetMyUserInfo, apiUserLogin, apiUserLogout } from '@/services';
@ -87,7 +87,7 @@ const useUserStore = create<UserState>()(
}, },
{ {
name: 'user', name: 'user',
getStorage: () => localStorage, storage: createJSONStorage(() => localStorage),
}, },
), ),
), ),

Loading…
Cancel
Save