Add zustand, true-myth, primitive authentication state, startup getSession()

This commit is contained in:
2024-11-10 20:41:58 -06:00
parent af5e42abe7
commit f18adf0f41
8 changed files with 159 additions and 19 deletions

View File

@@ -13,19 +13,26 @@ import { createFileRoute } from '@tanstack/react-router'
// Import Routes
import { Route as rootRoute } from './routes/__root'
import { Route as LoginImport } from './routes/login'
import { Route as DashboardImport } from './routes/dashboard'
// Create Virtual Routes
const LoginLazyImport = createFileRoute('/login')()
const IndexLazyImport = createFileRoute('/')()
// Create/Update Routes
const LoginLazyRoute = LoginLazyImport.update({
const LoginRoute = LoginImport.update({
id: '/login',
path: '/login',
getParentRoute: () => rootRoute,
} as any).lazy(() => import('./routes/login.lazy').then((d) => d.Route))
} as any)
const DashboardRoute = DashboardImport.update({
id: '/dashboard',
path: '/dashboard',
getParentRoute: () => rootRoute,
} as any)
const IndexLazyRoute = IndexLazyImport.update({
id: '/',
@@ -44,11 +51,18 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof IndexLazyImport
parentRoute: typeof rootRoute
}
'/dashboard': {
id: '/dashboard'
path: '/dashboard'
fullPath: '/dashboard'
preLoaderRoute: typeof DashboardImport
parentRoute: typeof rootRoute
}
'/login': {
id: '/login'
path: '/login'
fullPath: '/login'
preLoaderRoute: typeof LoginLazyImport
preLoaderRoute: typeof LoginImport
parentRoute: typeof rootRoute
}
}
@@ -58,37 +72,42 @@ declare module '@tanstack/react-router' {
export interface FileRoutesByFullPath {
'/': typeof IndexLazyRoute
'/login': typeof LoginLazyRoute
'/dashboard': typeof DashboardRoute
'/login': typeof LoginRoute
}
export interface FileRoutesByTo {
'/': typeof IndexLazyRoute
'/login': typeof LoginLazyRoute
'/dashboard': typeof DashboardRoute
'/login': typeof LoginRoute
}
export interface FileRoutesById {
__root__: typeof rootRoute
'/': typeof IndexLazyRoute
'/login': typeof LoginLazyRoute
'/dashboard': typeof DashboardRoute
'/login': typeof LoginRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: '/' | '/login'
fullPaths: '/' | '/dashboard' | '/login'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/login'
id: '__root__' | '/' | '/login'
to: '/' | '/dashboard' | '/login'
id: '__root__' | '/' | '/dashboard' | '/login'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
IndexLazyRoute: typeof IndexLazyRoute
LoginLazyRoute: typeof LoginLazyRoute
DashboardRoute: typeof DashboardRoute
LoginRoute: typeof LoginRoute
}
const rootRouteChildren: RootRouteChildren = {
IndexLazyRoute: IndexLazyRoute,
LoginLazyRoute: LoginLazyRoute,
DashboardRoute: DashboardRoute,
LoginRoute: LoginRoute,
}
export const routeTree = rootRoute
@@ -102,14 +121,18 @@ export const routeTree = rootRoute
"filePath": "__root.tsx",
"children": [
"/",
"/dashboard",
"/login"
]
},
"/": {
"filePath": "index.lazy.tsx"
},
"/dashboard": {
"filePath": "dashboard.tsx"
},
"/login": {
"filePath": "login.lazy.tsx"
"filePath": "login.tsx"
}
}
}