Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
feat : prevent professor delete himself
Browse files Browse the repository at this point in the history
  • Loading branch information
kasterra committed Jun 2, 2024
1 parent 8a115ac commit c117e98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
7 changes: 2 additions & 5 deletions app/routes/_procted+/lectures+/quiz+/edit/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import TextInput from "~/components/Input/TextInput";
import styles from "../index.module.css";
import judgeStyles from "~/css/judge.module.css";
import inputStyles from "~/components/Input/input.module.css";
import formStyles from "~/components/common/form.module.css";
import { MetaFunction, useNavigate, useSearchParams } from "@remix-run/react";
import { getUsersInLecture } from "~/API/lecture";
import { ReactNode, useEffect, useState } from "react";
import { useAuth } from "~/contexts/AuthContext";
import { QuizData, UserEntity } from "~/types/APIResponse";
import { QuizData } from "~/types/APIResponse";
import TableBase from "~/components/Table/TableBase";
import plusSquare from "~/assets/plus-square.svg";
import minusSquare from "~/assets/minus-square.svg";
Expand All @@ -16,7 +13,7 @@ import fileDownloadSVG from "~/assets/fileDownload.svg";
import { createQuizResultXlsx, parseQuizResultXlsx } from "~/util/xlsx";
import pkg from "file-saver";
import toast from "react-hot-toast";
import { createNewQuiz, getAllQuizes, updateQuiz } from "~/API/practice";
import { getAllQuizes, updateQuiz } from "~/API/practice";
import { safeParseInt } from "~/util";
import { extractStudentInfo, toTableData } from "~/util/quizUtil";
const { saveAs } = pkg;
Expand Down
32 changes: 17 additions & 15 deletions app/routes/admin+/users/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,23 @@ const Table = () => {
>
암호 초기화
</button>
<button
className={tableStyles["out-user"]}
onClick={async () => {
if (confirm("정말로 해당 유저를 삭제하시겠습니까?")) {
await toast.promise(deleteUser(elem.id, auth.token), {
loading: "삭제 요청중...",
success: "성공적으로 삭제되었습니다",
error: (err) =>
`Error: ${err.message} - ${err.responseMessage}`,
});
}
}}
>
회원 삭제하기
</button>
{elem.role === "professor" ? null : (
<button
className={tableStyles["out-user"]}
onClick={async () => {
if (confirm("정말로 해당 유저를 삭제하시겠습니까?")) {
await toast.promise(deleteUser(elem.id, auth.token), {
loading: "삭제 요청중...",
success: "성공적으로 삭제되었습니다",
error: (err) =>
`Error: ${err.message} - ${err.responseMessage}`,
});
}
}}
>
회원 삭제하기
</button>
)}
</>,
],
])
Expand Down

0 comments on commit c117e98

Please sign in to comment.