From a262abc0f57ba958ebd98c74cf9ca9a6bf1e234e Mon Sep 17 00:00:00 2001 From: Leon Yee <43097991+unkn-wn@users.noreply.github.com> Date: Wed, 18 Sep 2024 15:53:50 -0400 Subject: [PATCH] Revert "back button after going to detail from google search fixed ...?" --- src/pages/detail/[id].js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/pages/detail/[id].js b/src/pages/detail/[id].js index 662f4e9..e3f6e54 100644 --- a/src/pages/detail/[id].js +++ b/src/pages/detail/[id].js @@ -256,14 +256,11 @@ const CardDetails = ({ courseData, semData }) => { return gened[0].label; } - // Go back on back button, or go to home if no history or not from boilerclasses + // Go back on back button, or go to home if no history const goBack = () => { - const referrer = document.referrer; - const isFromBoilerClasses = referrer.includes(window.location.origin); - - if (isFromBoilerClasses && window.history?.length && window.history.length > 1) { + if (window.history?.length && window.history.length > 1) { router.back(); - // console.log(window.history.state); + console.log(window.history.state); if (!window.history.state?.as.includes("?q=")) { setTimeout(() => { router.reload(); @@ -272,7 +269,7 @@ const CardDetails = ({ courseData, semData }) => { } else { router.replace(window.location.origin || "/"); } - }; + } /////////////////////////////////////// RENDER /////////////////////////////////////////