Skip to content

Commit

Permalink
refactor: coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnsonMao committed Dec 26, 2024
1 parent 12e11cf commit 77bd863
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/Marathon/SignUp/MarathonForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default function MarathonForm({
reduxDispatch(updateNewMarathon(newMarathon));
setCurrentStep(currentStep - 1);
};

const validators = {
required: (value) => {
return value.trim().length > 0;
Expand All @@ -109,7 +109,7 @@ export default function MarathonForm({
const names = value.filter((milestone) => milestone?.name.trim().length > 0);
return names.length === milestonesLength;
}
}
};
const validateRules = {
title: {
validate: validators.required,
Expand Down Expand Up @@ -149,7 +149,7 @@ export default function MarathonForm({
validate: validators.required,
message: '請填寫學習資源'
}
}
};

const handleValidate = (name, input) => {
const validateResult = validateRules[name]?.validate(input);
Expand All @@ -169,9 +169,9 @@ export default function MarathonForm({
return validateResult;
};
const handleOnChange = (
stateDispatchType,
stateDispatchKey,
value,
stateDispatchType,
stateDispatchKey,
value,
validateName,
) => {
if (stateDispatchType && stateDispatchKey) {
Expand Down

0 comments on commit 77bd863

Please sign in to comment.