Skip to content

Commit

Permalink
fix: 변경된 api 명세에 맞추어 body값 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
geongyu09 committed Nov 30, 2024
1 parent 9249e11 commit b22f755
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions FE/src/apis/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export interface PostQuestionParams {
teamId: number;
questionContent: string;
parentsCommentId?: number;
isAnonymous: 0 | 1;
commentType: "ANONYMOUS" | "NON_ANONYMOUS";
}
export const postQuestion = async ({
programId,
teamId,
questionContent,
parentsCommentId = -1,
isAnonymous = 0,
commentType = "NON_ANONYMOUS",
}: PostQuestionParams) => {
return await https({
url: API.QUESTION.CREATE,
Expand All @@ -37,7 +37,7 @@ export const postQuestion = async ({
teamId,
content: questionContent,
parentsCommentId,
isAnonymous,
commentType,
},
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const DashboardInput = ({
selectedTeamId,
selectedTeamName,
}: DashboardInputProps) => {
const [isAnonymous, setIsAnonymous] = useAtom(dashboardAtoms.isAnonymous);
const [commentType, setCommentType] = useAtom(dashboardAtoms.commentType);
const [questionInput, setQuestionInput] = useAtom(
dashboardAtoms.questionInput,
);
Expand Down Expand Up @@ -51,7 +51,7 @@ const DashboardInput = ({
teamId: selectedTeamId,
questionContent,
parentsCommentId: selectedCommentId,
isAnonymous,
commentType,
};

postQuestion(postQuestionParams);
Expand All @@ -67,11 +67,8 @@ const DashboardInput = ({

return (
<div>
{/* <div className="absolute z-10 text-xl font-bold">{name}</div> */}
{isReply ? (
<div className="truncate text-lg font-semibold">
{/* <Image src={"/icons/x.svg"} alt="답글 종료" width={20} height={20} /> */}
{/* <button className="px-2 " onClick={() => setselectedCommentId(-1)}> */}
<button className="px-2 " onClick={resetSelectedComment}>
x
</button>
Expand All @@ -83,11 +80,14 @@ const DashboardInput = ({
<p className="text-xl font-bold">@{selectedTeamName} 에게 질문하기</p>
<label
className="flex select-none items-center justify-end gap-2 text-lg"
onClick={() => setIsAnonymous((prev) => (prev === 0 ? 1 : 0))}
onClick={() =>
setCommentType((prev) =>
prev === "ANONYMOUS" ? "NON_ANONYMOUS" : "ANONYMOUS",
)
}
>
<CheckBox
checked={isAnonymous === 1}
onClick={() => {}}
checked={commentType === "ANONYMOUS"}
className="h-5 w-5"
/>
익명으로 질문하기
Expand Down
4 changes: 2 additions & 2 deletions FE/src/store/dashboardAtoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { atomWithStorage } from "jotai/utils";
const selectedCommentId = atom(-1);
const selectedCommentContent = atom("");
const questionInput = atomWithStorage("questionInput", "");
const isAnonymous = atom<0 | 1>(0);
const commentType = atom<"ANONYMOUS" | "NON_ANONYMOUS">("NON_ANONYMOUS");

const dashboardAtoms = {
selectedCommentId,
selectedCommentContent,
questionInput,
isAnonymous,
commentType,
};

export default dashboardAtoms;

0 comments on commit b22f755

Please sign in to comment.