diff --git a/aeye/app/(nav)/report/generateButton.tsx b/aeye/app/(nav)/report/generateButton.tsx new file mode 100644 index 0000000..aa3f89a --- /dev/null +++ b/aeye/app/(nav)/report/generateButton.tsx @@ -0,0 +1,43 @@ +"use client"; +import { useState } from "react"; +import fetchWithInterception from "@/app/fetchWrapper"; +import Alert from "@mui/material/Alert"; +import CheckIcon from "@mui/icons-material/Check"; +import { Button, Box } from "@mui/material"; + +export default function GenerateButton() { + const [showAlert, setShowAlert] = useState(false); + + const sendRequest = () => { + fetchWithInterception("https://api.a-eye.live/email", { method: "POST" }) + .then((response) => response.json()) + .then((jsonData) => { + if (jsonData.code === 200) { + setShowAlert(true); + setTimeout(() => { + setShowAlert(false); + }, 2000); // Hide alert after 1 second + } + console.log(jsonData); + }); + }; + + return ( + <> + {showAlert && ( + } + severity="success" + sx={{ marginTop: "5px" }} + > + 이메일이 성공적으로 전송되었습니다. + + )} + + + + + ); +} diff --git a/aeye/app/(nav)/report/page.tsx b/aeye/app/(nav)/report/page.tsx index 509624c..52320b9 100644 --- a/aeye/app/(nav)/report/page.tsx +++ b/aeye/app/(nav)/report/page.tsx @@ -2,7 +2,8 @@ import * as React from "react"; import { DataGrid, GridColDef } from "@mui/x-data-grid"; import Typography from "@mui/material/Typography"; -import { Box } from "@mui/material"; +import { Box, Container } from "@mui/material"; +import GenerateButton from "@/app/(nav)/report/generateButton"; const columns: GridColDef[] = [ { field: "id", headerName: "ID", width: 70 }, @@ -89,7 +90,7 @@ export default async function Report() { }/${today.getFullYear()}`; return ( - <> + 관제일지 @@ -99,6 +100,7 @@ export default async function Report() { - + + ); } diff --git a/aeye/app/recoil-states.ts b/aeye/app/recoil-states.ts index 68c2ce0..f6ae790 100644 --- a/aeye/app/recoil-states.ts +++ b/aeye/app/recoil-states.ts @@ -15,4 +15,4 @@ const selectedTagsState = atom({ default: [], }); -export { searchQueryState, memberState, selectedTagsState }; +export { searchQueryState, memberState, selectedTagsState }; \ No newline at end of file