Skip to content

Commit

Permalink
refactor: 변경사항 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
brgndyy committed Oct 23, 2024
1 parent 23e6f2e commit 8d3f46a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/DiscussionSubmit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function DiscussionSubmit() {
discussionTitle,
isDiscussionTitleError,
isValidDiscussionTitle,
isValidDescription,
// isValidDescription,
handleDiscussionTitle,
handleMarkDownDescription,
isDescriptionError,
Expand Down Expand Up @@ -123,7 +123,7 @@ export default function DiscussionSubmit() {
/>
<DiscussionDescription
value={description}
danger={isDescriptionError || !isValidDescription}
danger={isDescriptionError}
dangerMessage={ERROR_MESSAGE.no_content}
onChange={handleMarkDownDescription}
/>
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/hooks/useDiscussionTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ const MAX_DISCUSSION_TITLE_LENGTH = 50;
const useDiscussionTitle = () => {
const [discussionTitle, setDiscussionTitle] = useState('');
const [isDiscussionTitleError, setIsDiscussionTitleError] = useState(false);
const isValidDiscussionTitle =
discussionTitle.length && discussionTitle.length < MAX_DISCUSSION_TITLE_LENGTH;
const isValidDiscussionTitle = discussionTitle.length < MAX_DISCUSSION_TITLE_LENGTH;

const handleDiscussionTitle = (e: ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/hooks/useSolutionTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const MAX_SOLUTION_TITLE_LENGTH = 50;
const useSolutionTitle = () => {
const [solutionTitle, setSolutionTitle] = useState('');
const [isSolutionTitleError, setIsSolutionTitleError] = useState(false);
const isValidSolutionTitle =
solutionTitle.length && solutionTitle.length < MAX_SOLUTION_TITLE_LENGTH;
const isValidSolutionTitle = solutionTitle.length < MAX_SOLUTION_TITLE_LENGTH;

const handleSolutionTitle = (e: ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/hooks/useSubmitSolutionMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ const useSubmitSolutionMutation = ({
}: UseSubmissionMutationParams) => {
const navigate = useNavigate();

const { mutate: submitSolutionMutation, isPending } = useSingleRequestMutation({
const {
mutate: submitSolutionMutation,
isPending,
isError: isSubmitSolutionError,
} = useSingleRequestMutation({
mutationFn: postSolutionSubmit,
onSuccess: ({ id }) => {
onSuccessCallback();
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/MissionSubmitPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default function MissionSubmitPage() {
isDescriptionError,
isSolutionTitleError,
isSubmitSolutionError,
isValidUrl,
isValidDescription,
// isValidUrl,
// isValidDescription,
isValidSolutionTitle,
// isMatchedMissionName,
} = useSubmitSolution({ missionId, missionName });
Expand Down Expand Up @@ -97,10 +97,10 @@ export default function MissionSubmitPage() {
value={url}
onChange={handleUrl}
missionId={missionId}
danger={isUrlError || isSubmitSolutionError || !isValidUrl}
danger={isUrlError || isSubmitSolutionError}
/>
<OneWord
danger={isDescriptionError || !isValidDescription}
danger={isDescriptionError}
dangerMessage={ERROR_MESSAGE.no_content}
value={description ?? ''}
onChange={handleMarkDownDescription}
Expand Down

0 comments on commit 8d3f46a

Please sign in to comment.