import { create } from "zustand" import { persist } from "zustand/middleware" const initUserInfo = { user_id: null, user_name: null, user_password: null, detailInfo: null, } export const usePermissionStore = create( persist( (set) => ({ user_id: null, user_name: null, user_password: null, detailInfo: null, setUserPermissionInfo: ({ user_id, user_name, detailInfo }: any) => set({ user_id, user_name, detailInfo, user_password: usePermissionStore.getState().user_password, }), setUserPassword: (user_password: string) => set((state: any) => { return { ...state, user_password, } }), logout: () => set(initUserInfo), }), { name: "label_permission", } ) )