File tree Expand file tree Collapse file tree 3 files changed +7
-16
lines changed
Expand file tree Collapse file tree 3 files changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export async function redirectCookie(formData: FormData) {
1818 cookies ( ) . set ( AUTH_REDIRECT_KEY , redirectUrl , {
1919 maxAge : 60 * 5 ,
2020 } ) ;
21- redirect ( '/(.) signin' ) ;
21+ redirect ( '/signin' ) ;
2222}
2323
2424export default redirectCookie ;
Original file line number Diff line number Diff line change 1- 'use client' ;
2-
3- import { usePathname , useRouter } from 'next/navigation' ;
4- import { useEffect } from 'react' ;
5-
61import LoginStep from '@/features/auth/LoginStep' ;
72
83const SignInModal = ( ) => {
9- const router = useRouter ( ) ;
10- const pathname = usePathname ( ) ;
11-
12- useEffect ( ( ) => {
13- if ( pathname === '/(.)signin' ) {
14- router . replace ( '/signin' ) ;
15- }
16- } , [ pathname , router ] ) ;
17-
184 return < LoginStep isModal = { true } /> ;
195} ;
206
Original file line number Diff line number Diff line change 11'use client' ;
22
3- import { useRouter } from 'next/navigation' ;
3+ import { usePathname , useRouter } from 'next/navigation' ;
44import { ReactNode , useRef } from 'react' ;
55
66import Backdrop from '@/components/common/Backdrop' ;
77import Modal from '@/components/common/Modal' ;
88import useClickOutside from '@/hooks/useClickOutside' ;
99
10+ const MODAL_PATHS = [ '/signin' , '/signup' , '/verify-email' ] ;
11+
1012const ModalLayout = ( { children} : { children : ReactNode } ) => {
13+ const pathname = usePathname ( ) ;
1114 const router = useRouter ( ) ;
1215 const ref = useRef < HTMLDivElement > ( null ) ;
1316 useClickOutside ( ref , ( ) => router . back ( ) ) ;
1417
18+ if ( ! MODAL_PATHS . includes ( pathname ) ) return null ;
19+
1520 return (
1621 < Backdrop >
1722 < Modal ref = { ref } > { children } </ Modal >
You can’t perform that action at this time.
0 commit comments