Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions frontend/src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ const Header = () => {
height={30}
/>
</button>
) : (
<div style={{ width: "30px" }} />
)}
) : null}
{showRightMagageStudent ? (
<button
className="icon-button"
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/componentsCss/Header.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
display: flex;
align-items: center;
width: 390px;
justify-content: space-between;
justify-content: flex-start;
padding: 1rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
gap: 100px;
box-shadow: 0 2px 4px #0003;
margin: 10px;
}

Expand Down
24 changes: 23 additions & 1 deletion frontend/src/pages/admin/AttendanceCode.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
import { useState } from "react";
import api from "../../api/api";
import Header from "../../components/Header";
import style from "./AttendanceCode.module.css";
import { useState, useEffect } from "react";

const AttendanceCode = () => {
const [code, setCode] = useState("");

useEffect(() => {
const expireIfNeeded = async () => {
try {
const res = await api.get("admin/attendance/active-code");
const activeCode = res.data.data.code;

await api.put("admin/attendance/expire", null, {
params: { code: activeCode },
});

console.log("기존 출석코드 자동 만료됨");
} catch (error) {
if (error.response?.status !== 404) {
alert(
"초기화 중 오류: " + (error.response?.data?.message || "서버 오류")
);
}
}
};

expireIfNeeded();
}, []);
// 출석코드 생성
const generateCode = async () => {
try {
Expand Down