From d7142f6b5adfa6bc1f781387c7d5c24b9c026b21 Mon Sep 17 00:00:00 2001 From: "Au Chen Xi, Gabriel" Date: Mon, 13 Nov 2023 22:58:00 +0800 Subject: [PATCH] Fix toast at wrong location --- src/hooks/useMatchUsers.ts | 2 ++ src/pages/collab/index.tsx | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hooks/useMatchUsers.ts b/src/hooks/useMatchUsers.ts index 40fb746..6302d79 100644 --- a/src/hooks/useMatchUsers.ts +++ b/src/hooks/useMatchUsers.ts @@ -1,6 +1,7 @@ import { useSession } from "next-auth/react"; import { useRouter } from "next/router"; import { useEffect, useState } from "react"; +import toast from "react-hot-toast"; import { api } from "~/utils/api"; type UseMatchUsersResult = { @@ -23,6 +24,7 @@ export default function useMatchUsers(): UseMatchUsersResult { data.user2 === session?.user.id ) { console.log("Routing"); + toast.success("Redirecting to room..."); void router.push(`/collab/rooms/${data.sessionId}`); } }, diff --git a/src/pages/collab/index.tsx b/src/pages/collab/index.tsx index 022c246..537d303 100644 --- a/src/pages/collab/index.tsx +++ b/src/pages/collab/index.tsx @@ -173,7 +173,6 @@ const MatchRequestPage = () => { api.matchRequest.subscribeToMyRequestSuccess.useSubscription(undefined, { onData(data) { matchUsers.setMatchedUsers(data.userId1, data.userId2); - toast.success("Redirecting to room..."); }, }); // subscprtions api -- END