Skip to content

Commit

Permalink
fix: defaultValue 적용 안되는 문제
Browse files Browse the repository at this point in the history
  • Loading branch information
hamo-o committed Aug 29, 2024
1 parent 2f0aede commit 4e3028c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { useController } from "react-hook-form";
import type { TextFieldProps } from "wowds-ui/TextField";
import TextField from "wowds-ui/TextField";
Expand All @@ -7,7 +9,6 @@ interface CustomTextFieldProps extends TextFieldProps {
control: any;
}

// TODO: defaultValue 적용 안되는 문제
const CustomTextField = ({
name,
control,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@ const Assignments = ({
}) => {
const { open, onOpen } = useOpenState();

const methods = useForm<
AssignmentApiRequestDto & {
onOpen: () => void;
}
>({
defaultValues: {
title: "",
deadLine: "2024-09-07T00:00:00",
descriptionNotionLink: "",
onOpen: onOpen,
},
});

const [assignment, setAssignment] = useState<AssignmentApiResponseDto | null>(
null
);
Expand All @@ -47,6 +34,19 @@ const Assignments = ({
fetchAssignment();
}, [studyDetailId]);

const methods = useForm<
AssignmentApiRequestDto & {
onOpen: () => void;
}
>({
defaultValues: {
title: assignment?.title,
deadLine: "2024-09-07T00:00:00",
descriptionNotionLink: assignment?.descriptionLink,
onOpen: onOpen,
},
});

if (!assignment) return null;

const { assignmentStatus, week } = assignment;
Expand Down

0 comments on commit 4e3028c

Please sign in to comment.