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

Commit

Permalink
fix : wrong drag behaviour when drag
Browse files Browse the repository at this point in the history
  • Loading branch information
kasterra committed May 18, 2024
1 parent c6b49be commit a6076eb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/routes/_procted+/students+/$lectureId+/UserAddModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const UserAddModal = ({ isOpen, onClose }: Props) => {
const params = useParams();
const lectureId = parseInt(params.lectureId!, 10);
const [tabIndex, setTabIndex] = useState(0);
const [file, setFile] = useState<File | null>(null);
return (
<Modal
title="학생 등록"
Expand All @@ -35,10 +36,10 @@ const UserAddModal = ({ isOpen, onClose }: Props) => {
e.preventDefault();
const formData = new FormData(e.currentTarget);
if (tabIndex === 0) {
const file = formData.get("file") as File;
const formFile = file ? file : (formData.get("file") as File);
const response = await addUsersInLecture(
lectureId,
await parseXlsx(file),
await parseXlsx(formFile),
auth.token
);
if (response.status === 201) {
Expand Down Expand Up @@ -76,7 +77,7 @@ const UserAddModal = ({ isOpen, onClose }: Props) => {
<SingleFileInput
title="학생 명부 엑셀 파일"
name="file"
onFileUpload={(file) => console.log(file.name)}
onFileUpload={(file) => setFile(file)}
fileValidator={(file) => file.name.endsWith(".xlsx")}
placeholder="xlsx 파일 업로드"
/>
Expand Down

0 comments on commit a6076eb

Please sign in to comment.