Skip to content

Commit

Permalink
do not save date in url
Browse files Browse the repository at this point in the history
  • Loading branch information
doboy committed Sep 13, 2024
1 parent 54219ed commit 4742c5a
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ const PARKS = [{
name: "Rainier Beach Court 3",
}]

const updateQueryStringParameter = (key, val) => {
const uri = new URL(window.location.href);
uri.searchParams.set(key, val);
window.history.replaceState({}, "z.i.t.n.r", uri.href);
};

const classnames = (args) => {
return args.map((arg) => {
if (typeof arg == "string") {
Expand Down Expand Up @@ -242,10 +236,9 @@ const ZitnrTab = () => {
};

const CalendarTab = () => {
const params = new URL(window.location.href).searchParams;
const [isLoading, setIsLoading] = React.useState(true);
const [date, setDate] = React.useState(params.get("date") || moment().format("YYYY-MM-DD"));
const [park, setPark] = React.useState(params.get("parkId") || MILLER_PARK_ID);
const [date, setDate] = React.useState(moment().format("YYYY-MM-DD"));
const [park, setPark] = React.useState(MILLER_PARK_ID);
const [unreservedData, setUnreservedData] = React.useState({});
const [securedData, setSecuredData] = React.useState({});

Expand Down Expand Up @@ -302,7 +295,6 @@ const CalendarTab = () => {
$(ref).dropdown({
onChange: function (value) {
setPark(value);
updateQueryStringParameter("parkId", value);
}
});
}}>
Expand All @@ -322,7 +314,6 @@ const CalendarTab = () => {
<div className="ui input">
<input type="date" value={date} placeholder="Search..." onChange={(e) => {
setDate(e.target.value);
updateQueryStringParameter("date", e.target.value);
}} />
</div>
</div>
Expand Down Expand Up @@ -546,10 +537,9 @@ const OverviewTab = () => {


const MILLER_PARK_ID = "1374";
const params = new URL(window.location.href).searchParams;
const [isLoading, setIsLoading] = React.useState(true);
const [date] = React.useState(params.get("date") || moment().format("YYYY-MM-DD"));
const [park] = React.useState(params.get("parkId") || MILLER_PARK_ID);
const [date] = React.useState(moment().format("YYYY-MM-DD"));
const [park] = React.useState(MILLER_PARK_ID);
const [unreservedData, setUnreservedData] = React.useState({});
const [securedData, setSecuredData] = React.useState({});

Expand Down

0 comments on commit 4742c5a

Please sign in to comment.