u
This commit is contained in:
1 parent
6277fb2f9e
commit
8ecac0d7dd
270 files changed
+40438
-529
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { router } from 'expo-router'
|
||||
// store/navigation.ts
|
||||
import { create } from 'zustand'
|
||||
|
||||
interface NavState {
|
||||
pathname: string
|
||||
setPathname: (p: string) => void
|
||||
navigateToAuth: () => void
|
||||
}
|
||||
|
||||
export const useNavStore = create<NavState>(set => ({
|
||||
pathname: '/',
|
||||
setPathname: (p: string) => set({ pathname: p }),
|
||||
navigateToAuth: () => {
|
||||
const pathname = useNavStore.getState().pathname
|
||||
|
||||
if (!pathname.startsWith('/auth')) {
|
||||
router.replace('/auth')
|
||||
}
|
||||
},
|
||||
}))
|
||||
Reference in new issue
Block a user