Skip to content

Commit

Permalink
adjust share navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Falsal committed Aug 12, 2024
1 parent 55500c8 commit fc7eb80
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/views/Main/DetailReworked.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,25 @@ useEffect(() => {
}
const redirectSearchParams = new URLSearchParams();
const date = moment(res.date);

redirectSearchParams.set("id", res.tourId);
redirectSearchParams.set("city", res.city);
redirectSearchParams.set(
"datum",
moment(date).format("YYYY-MM-DD")
);
const todayDate = new Date();


const redirectUrl = todayDate >= date ? `/tour/${res.tourId}/${res.city}/?datum=${moment(date).format("YYYY-MM-DD")}` :
`/tour/${res.tourId}/${res.city}`


localStorage.setItem("tourId", res.tourId);
if(!!idOne && !!cityOne){
navigate(`/tour/${idOne}/${_city.value}`);
console.log("L295 ", res.tourId)
console.log("L296 ", res.City)
if(!!res.tourId && !!res.city){
navigate(redirectUrl);
}else{
//URL redirect : /tour? id=2690&city=amstetten&datum=2024-01-17
navigate(`/tour?${redirectSearchParams.toString()}`);
Expand Down

0 comments on commit fc7eb80

Please sign in to comment.