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';
66import { Button } from '@/components/ui/button' ;
77import { useAuthStore } from '@/state/useAuthStore' ;
88import { consumeMessageFromQueue , sendMessageToQueue } from '@/lib/rabbitmq' ;
9- import { UserMatchingResponse } from '@/types/types' ;
9+ import { UserMatchingRequest , UserMatchingResponse } from '@/types/types' ;
1010
1111export default function LoadingPage ( ) {
1212 const [ elapsedTime , setElapsedTime ] = useState ( 0 ) ;
@@ -61,12 +61,16 @@ export default function LoadingPage() {
6161
6262 const handleCancel = ( ) => {
6363 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+ }
7074 } ;
7175
7276 return (
You can’t perform that action at this time.
0 commit comments