Skip to content

Commit

Permalink
🐛 Switch to built-in search params
Browse files Browse the repository at this point in the history
  • Loading branch information
micahlt committed Jul 17, 2024
1 parent 520bf67 commit f76f03f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/admin/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
TableCell,
TextInput,
} from "@tremor/react";
import { useRouter, useSearchParams } from "next/navigation";
import { useRouter } from "next/navigation";
import firebase from "firebase/compat/app";
import "firebase/compat/auth";
import {
Expand All @@ -47,10 +47,10 @@ const firebaseConfig = {
appId: "1:545159752910:web:bd66c8c0e7e0b2d0d6f49f",
};
firebase.initializeApp(firebaseConfig);
export default function Admin() {
const params = useSearchParams();
export default function Admin({ searchParams }) {
const params = searchParams;
const [date, setDate] = useState(
params.get("date") ? new Date(params.get("date")) : new Date()
params?.data ? new Date(params?.date) : new Date()
);
const { data, isLoading, mutate } = useSWR(
`/api/meals?date=${date.toLocaleDateString("en-CA")}`,
Expand Down

1 comment on commit f76f03f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for mc-caf-data ready!

✅ Preview
https://mc-caf-data-ro5gs0zd0-thecafapp.vercel.app

Built with commit f76f03f.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.