Skip to content

Commit

Permalink
feat: add authentication check before editing parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Patek committed Feb 21, 2025
1 parent 85f18e1 commit 6bd249b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions components/tower/tiles/parameters/dialog/EditButton.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
"use client";

import { checkAuth } from "@/actions/checkAuth";
import { showModalWithoutFocus } from "@/utils/showModal";
import { useRouter } from "next/navigation";

const EditButton = () => {
const router = useRouter();

return (
<button
className="btn btn-warning"
onClick={() => {
(document.getElementById("parameters-modal") as HTMLDialogElement).close();
showModalWithoutFocus("edit_parameters");
onClick={async () => {
if ((await checkAuth()) !== null) {
(document.getElementById("parameters-modal") as HTMLDialogElement).close();
showModalWithoutFocus("edit_parameters");
} else {
return router.push("/signin");
}
}}
>
Navrhnout úpravu
Expand Down

0 comments on commit 6bd249b

Please sign in to comment.