File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
peerprep-fe/src/app/(main)/match Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { User, Code } from 'lucide-react';
6
6
import { Button } from '@/components/ui/button' ;
7
7
import { useAuthStore } from '@/state/useAuthStore' ;
8
8
import { consumeMessageFromQueue , sendMessageToQueue } from '@/lib/rabbitmq' ;
9
- import { UserMatchingResponse } from '@/types/types' ;
9
+ import { UserMatchingRequest , UserMatchingResponse } from '@/types/types' ;
10
10
11
11
export default function LoadingPage ( ) {
12
12
const [ elapsedTime , setElapsedTime ] = useState ( 0 ) ;
@@ -61,12 +61,16 @@ export default function LoadingPage() {
61
61
62
62
const handleCancel = ( ) => {
63
63
console . log ( 'Matching cancelled' ) ;
64
- const message = {
65
- _id : user ?. id ,
66
- type : "cancel" ,
67
- } ;
68
- sendMessageToQueue ( message ) ;
69
- router . push ( '/' ) ;
64
+ if ( user ?. id ) {
65
+ const message : UserMatchingRequest = {
66
+ _id : user ?. id ,
67
+ type : "cancel" ,
68
+ } ;
69
+ sendMessageToQueue ( message ) ;
70
+ router . push ( '/' ) ;
71
+ } else {
72
+ console . warn ( "User ID is undefined. This is not supposed to happen." ) ;
73
+ }
70
74
} ;
71
75
72
76
return (
You can’t perform that action at this time.
0 commit comments