login page

This commit is contained in:
naiba
2024-11-02 22:34:43 +08:00
parent d945ca97c1
commit 017e6cfdcf
32 changed files with 2236 additions and 170 deletions
+16
View File
@@ -0,0 +1,16 @@
import { MainStore, User } from '@/types'
import { create } from 'zustand'
import { persist, createJSONStorage } from 'zustand/middleware'
export const useMainStore = create<MainStore, [['zustand/persist', MainStore]]>(
persist(
(set, get) => ({
profile: get()?.profile,
setProfile: (profile: User | undefined) => set({ profile }),
}),
{
name: 'mainStore',
storage: createJSONStorage(() => localStorage),
},
),
)