File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import React from 'react'
4
4
import client from '@/utils/client'
5
- import { useRouter } from ' next/navigation'
5
+ import { useSearchParams } from " next/navigation" ;
6
6
import styles from "./answer.module.css" ;
7
7
8
8
@@ -16,8 +16,7 @@ const LoadingSpinner = () => {
16
16
17
17
18
18
const Answer = ( ) => {
19
- const router = useRouter ( )
20
- const query = router . query
19
+ const token = useSearchParams ( ) . get ( 'token' )
21
20
const [ choice , setChoice ] = React . useState ( null )
22
21
const [ loading , setLoading ] = React . useState ( false )
23
22
@@ -30,7 +29,7 @@ const Answer = () => {
30
29
try {
31
30
setLoading ( true )
32
31
const test = await client ( ) . post ( `/api/responses` , {
33
- token : query . token ,
32
+ token : token ,
34
33
choice
35
34
} )
36
35
if ( test . message )
You can’t perform that action at this time.
0 commit comments