Skip to content

Commit

Permalink
fix: materials used validation error on creating new project (#1126)
Browse files Browse the repository at this point in the history
  • Loading branch information
yokwejuste authored Apr 30, 2024
1 parent e1c4774 commit f4abd0c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 2 additions & 0 deletions zubhub_frontend/zubhub/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 11 additions & 14 deletions zubhub_frontend/zubhub/src/views/create_project/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,21 +693,18 @@ export const validationSchema = Yup.object().shape({
// ? false
// : true;
// }),
materials_used: Yup.string()
.max(10000, 'max')
.test('empty', 'required', value => {
let is_empty = true;

value &&
value.split(',').forEach(material => {
if (material) {
is_empty = false;
}
});
materials_used: Yup.array()
.max(10000, 'max')
.test('empty', 'required', value => {
let is_empty = true;

return !is_empty;
}),
category: Yup.string(),
if (value && value.length > 0) {
is_empty = false;
}

return !is_empty;
}),
category: Yup.array(),
// tags: Yup.mixed().test('unsupported', 'unsupported', tags => {
// if (tags) {
// tags = JSON.parse(tags);
Expand Down

0 comments on commit f4abd0c

Please sign in to comment.