File tree Expand file tree Collapse file tree 5 files changed +9
-31
lines changed Expand file tree Collapse file tree 5 files changed +9
-31
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ export const loader =
19
19
async ( { request } : LoaderFunctionArgs ) => {
20
20
const route = new URL ( request . url ) ;
21
21
const path = route . pathname ;
22
- const authedRoutes = [ ROUTES . HOME ] ;
22
+ const unAuthedRoutes = [ ROUTES . LOGIN , ROUTES . SIGNUP , ROUTES . FORGOT_PASSWORD ] ;
23
+ const unAuthedRoute = unAuthedRoutes . includes ( path ) ;
23
24
24
25
return defer ( {
25
26
isAuthed : await queryClient . ensureQueryData ( {
@@ -33,7 +34,7 @@ export const loader =
33
34
return Math . max ( expiresAt . getTime ( ) - now . getTime ( ) , 0 ) ;
34
35
} ,
35
36
} ) ,
36
- authedRoute : authedRoutes . includes ( path ) ,
37
+ authedRoute : ! unAuthedRoute ,
37
38
path,
38
39
} ) ;
39
40
} ;
Original file line number Diff line number Diff line change 1
1
import { createBrowserRouter } from 'react-router-dom' ;
2
2
3
- import { Layout } from '@/components/blocks/layout' ;
3
+ import { AuthedLayout } from '@/components/blocks/authed-layout' ;
4
+ import { RootLayout } from '@/components/blocks/root-layout' ;
4
5
import { RouteGuard , loader as routeGuardLoader } from '@/components/blocks/route-guard' ;
5
6
6
7
import { ForgotPassword } from '@/routes/forgot-password' ;
7
- import { Landing } from '@/routes/landing' ;
8
8
import { Login } from '@/routes/login' ;
9
9
import { loader as qnDetailsLoader , QuestionDetails } from '@/routes/questions/details' ;
10
10
import { SignUp } from '@/routes/signup' ;
@@ -14,15 +14,15 @@ import { ROUTES } from './routes';
14
14
15
15
export const router = createBrowserRouter ( [
16
16
{
17
- element : < Layout /> ,
17
+ element : < RootLayout /> ,
18
18
children : [
19
19
{
20
20
element : < RouteGuard /> ,
21
21
loader : routeGuardLoader ( queryClient ) ,
22
22
children : [
23
23
{
24
24
path : ROUTES . HOME ,
25
- element : < Landing /> ,
25
+ element : < AuthedLayout /> ,
26
26
children : [
27
27
{
28
28
path : ROUTES . QUESTION_DETAILS ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ export const QuestionDetails = () => {
68
68
const { questionId } = useLoaderData ( ) as Awaited < ReturnType < ReturnType < typeof loader > > > ;
69
69
const { data : details } = useSuspenseQuery ( questionDetailsQuery ( questionId ) ) ;
70
70
return (
71
- < div className = 'flex h-[calc(100dvh-64px)] w-full flex-col' >
71
+ < >
72
72
< div className = 'bg-secondary/50 flex w-full p-4 px-6' >
73
73
< Breadcrumb >
74
74
< BreadcrumbList >
@@ -131,6 +131,6 @@ export const QuestionDetails = () => {
131
131
</ Card >
132
132
< div className = 'flex flex-1 flex-col' />
133
133
</ div >
134
- </ div >
134
+ </ >
135
135
) ;
136
136
} ;
You can’t perform that action at this time.
0 commit comments