-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
143 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
"use client"; | ||
|
||
import { CommonAxios } from "@/utils/CommonAxios"; | ||
import { Button } from "@mantine/core"; | ||
|
||
export default function Home() { | ||
return <main>Hello, world!</main>; | ||
const body = { | ||
name: "stop-user", | ||
phoneNumber: "010-1234-1234", | ||
userType: "INACTIVE_PROFESSOR", | ||
email: "[email protected]", | ||
signUpSource: "ad", | ||
division: null, | ||
position: null, | ||
}; | ||
|
||
return ( | ||
<main> | ||
<Button | ||
onClick={() => { | ||
CommonAxios.post("/auth/register", body); | ||
}} | ||
/> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/components/pages/AdminApplicationListSection/ApplicationConfirmModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
"use client"; | ||
|
||
import { PrimaryButton } from "@/components/common/Buttons"; | ||
import { Row } from "@/components/common/Row"; | ||
import { DetailedApplication, PagedApplicationsResponse } from "@/types/application"; | ||
import { CommonAxios } from "@/utils/CommonAxios"; | ||
import { Modal, ModalProps, Stack, Text } from "@mantine/core"; | ||
import { useEffect, useState } from "react"; | ||
import { KeyedMutator } from "swr"; | ||
|
||
interface ApplicationConfirmModalProps extends ModalProps { | ||
applicationId: number; | ||
mutate: KeyedMutator<PagedApplicationsResponse>; | ||
} | ||
|
||
export function ApplicationConfirmModal({ | ||
applicationId, | ||
mutate, | ||
...props | ||
}: ApplicationConfirmModalProps) { | ||
const [application, setApplication] = useState<DetailedApplication | null>(null); | ||
|
||
// 가입 승인 | ||
const handleConfirm = async () => { | ||
try { | ||
await CommonAxios.patch(`/applications/${applicationId}`); | ||
mutate(); | ||
close(); | ||
} catch (error) { | ||
// TODO: 에러 처리 | ||
console.error(error); | ||
} | ||
}; | ||
|
||
// 가입 신청 정보 가져오기 | ||
useEffect(() => { | ||
const fetchApplication = async () => { | ||
const { data } = await CommonAxios.get<DetailedApplication>(`/applications/${applicationId}`); | ||
setApplication(data); | ||
}; | ||
|
||
fetchApplication(); | ||
}, [applicationId]); | ||
|
||
return ( | ||
<Modal radius={"md"} {...props}> | ||
<Stack gap={"xl"} align="center"> | ||
<Text fz={20} fw={600}> | ||
가입 승인 | ||
</Text> | ||
<Stack gap={"xl"} align="flex-start" justify="center" mb={20}> | ||
<Row field="이름" fieldWeight={600} pl={10}> | ||
{application?.name} | ||
</Row> | ||
<Row field="전화번호" fieldWeight={600} pl={10}> | ||
{application?.phone} | ||
</Row> | ||
<Row field="이메일" fieldWeight={600} pl={10}> | ||
{application?.email} | ||
</Row> | ||
<Row field="소속" fieldWeight={600} pl={10}> | ||
{application?.division} | ||
</Row> | ||
<Row field="직책" fieldWeight={600} pl={10}> | ||
{application?.position} | ||
</Row> | ||
</Stack> | ||
<PrimaryButton w={"100%"} onClick={handleConfirm}> | ||
승인 | ||
</PrimaryButton> | ||
</Stack> | ||
</Modal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Role } from "@/types/user"; | ||
|
||
export const USER_TYPE_LOOKUP_TABLE: Record<Role, string> = { | ||
STUDENT: "학생", | ||
PROFESSOR: "교수", | ||
COMPANY: "기업관계자", | ||
ADMIN: "관리자", | ||
INACTIVE_PROFESSOR: "미승인 교수", | ||
INACTIVE_COMPANY: "미승인 기업관계자", | ||
OTHERS: "기타", | ||
TEMP: "임시", | ||
}; |