File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
app/(services)/google/oauth/callback Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11"use client" ;
22
33import React , { useState , useEffect } from "react" ;
4- import { useRouter } from "next/navigation" ;
4+ import { useRouter , useSearchParams } from "next/navigation" ;
5+
6+ export default function GDriveCallback ( props ) {
7+ const searchParams = useSearchParams ( ) ;
58
6- export default function GDriveCallback ( { searchParams } ) {
79 const [ loading , setLoading ] = useState ( true ) ;
810 const [ success , setSuccess ] = useState ( false ) ;
911 const [ message , setMessage ] = useState ( "" ) ;
1012
1113 const router = useRouter ( ) ;
1214
1315 useEffect ( ( ) => {
14- if ( searchParams . code ) {
15- localStorage . setItem ( "gdriveCode" , searchParams . code ) ;
16+ const code = searchParams . get ( "code" ) ;
17+
18+ if ( code ) {
19+ localStorage . setItem ( "gdriveCode" , code ) ;
1620 setSuccess ( true ) ;
1721 router . push ( "/google/oauth/callback?success=true" ) ;
1822 setMessage ( "Successfully authenticated with Google Drive" ) ;
You can’t perform that action at this time.
0 commit comments