Skip to content

Commit

Permalink
Merge pull request #116 from unkn-wn/revert-115-temp
Browse files Browse the repository at this point in the history
Revert "back button after going to detail from google search fixed ...?"
  • Loading branch information
unkn-wn authored Sep 18, 2024
2 parents ce05d43 + a262abc commit 58dcaff
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/pages/detail/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -272,7 +269,7 @@ const CardDetails = ({ courseData, semData }) => {
} else {
router.replace(window.location.origin || "/");
}
};
}


/////////////////////////////////////// RENDER /////////////////////////////////////////
Expand Down

0 comments on commit 58dcaff

Please sign in to comment.