File tree Expand file tree Collapse file tree
playground/connect-next/app/redirect Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use client' ;
22
3- import { redirect , useRouter , useSearchParams } from 'next/navigation' ;
3+ import { useRouter , useSearchParams } from 'next/navigation' ;
44import { setIdToken } from './actions' ;
5- import { useEffect , useState } from 'react' ;
5+ import { Suspense , useEffect , useState } from 'react' ;
66
77export default function Page ( ) {
8+ return (
9+ < Suspense >
10+ < Redirecting />
11+ </ Suspense >
12+ ) ;
13+ }
14+
15+ function Redirecting ( ) {
816 const searchParams = useSearchParams ( ) ;
17+ const token = searchParams . get ( 'token' ) ;
18+ const redirectUrl = searchParams . get ( 'redirectUrl' ) ;
919 const [ loading , setLoading ] = useState ( true ) ;
1020 const router = useRouter ( ) ;
1121
1222 useEffect ( ( ) => {
1323 const init = async ( ) => {
14- const token = searchParams . get ( 'token' ) ;
15- const redirectUrl = searchParams . get ( 'redirectUrl' ) ;
1624 if ( ! token || ! redirectUrl ) {
1725 return ;
1826 }
You can’t perform that action at this time.
0 commit comments