u
This commit is contained in:
1 parent
fc005e0fb4
commit
10d0cadfe3
18 files changed
+591
-133
No files matched your search
@@ -23,28 +23,22 @@ const DEFAULT_NAV_MENUS: NavItem[] = [
|
||||
{ label: '恋爱记', path: '/love', icon: 'Heart' },
|
||||
{ label: '聊天', path: '/chat', icon: 'MessageCircle' },
|
||||
{ label: '个人中心', path: '/user', icon: 'CircleUserRound' },
|
||||
{ label: '我的空间', path: '/auth/space', icon: 'Earth' },
|
||||
{ label: '我的空间', path: '/space/manage', icon: 'Earth' },
|
||||
]
|
||||
|
||||
export const useNavStore = create<NavState>()(
|
||||
persist(
|
||||
(set, get) => ({
|
||||
pathname: '/',
|
||||
navMenus: DEFAULT_NAV_MENUS,
|
||||
(set, get) => ({
|
||||
pathname: '/',
|
||||
navMenus: DEFAULT_NAV_MENUS,
|
||||
|
||||
setPathname: (p: string) => set({ pathname: p }),
|
||||
navigateToAuth: () => {
|
||||
const pathname = useNavStore.getState().pathname
|
||||
setPathname: (p: string) => set({ pathname: p }),
|
||||
navigateToAuth: () => {
|
||||
const pathname = useNavStore.getState().pathname
|
||||
|
||||
if (pathname !== '/auth') {
|
||||
router.replace('/auth')
|
||||
}
|
||||
},
|
||||
setNavMenus: navMenus => set({ navMenus }),
|
||||
}),
|
||||
{
|
||||
name: 'nav-storage',
|
||||
storage: createJSONStorage(() => AsyncStorage),
|
||||
if (pathname !== '/auth') {
|
||||
router.replace('/auth')
|
||||
}
|
||||
},
|
||||
),
|
||||
setNavMenus: navMenus => set({ navMenus }),
|
||||
}),
|
||||
)
|
||||
Reference in new issue
Block a user