Merge branch 'main' of https://github.com/Nikhil569/bruno into main

This commit is contained in:
Nikhil569 2023-10-11 02:58:05 +05:30
commit 9e8488d417
2 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,7 @@ const NewFolder = ({ collection, item, onClose }) => {
},
validationSchema: Yup.object({
folderName: Yup.string()
.trim()
.min(1, 'must be at least 1 character')
.required('name is required')
.test({
@ -32,7 +33,7 @@ const NewFolder = ({ collection, item, onClose }) => {
onSubmit: (values) => {
dispatch(newFolder(values.folderName, collection.uid, item ? item.uid : null))
.then(() => onClose())
.catch((err) => toast.error(err ? err.message : 'An error occurred while adding the request'));
.catch((err) => toast.error(err ? err.message : 'An error occurred while adding the folder'));
}
});

View File

@ -25,13 +25,14 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => {
},
validationSchema: Yup.object({
requestName: Yup.string()
.trim()
.min(1, 'must be at least 1 character')
.required('name is required')
.test({
name: 'requestName',
message: `The request names - collection and folder is reserved in bruno`,
test: (value) => {
const trimmedValue = value.trim().toLowerCase();
const trimmedValue = value ? value.trim().toLowerCase() : '';
return !['collection', 'folder'].includes(trimmedValue);
}
})