mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-22 04:31:35 +01:00
feat: error messaging when attempting to create duplicate files or folders in local collections
This commit is contained in:
parent
e98f219448
commit
eefef27dec
@ -1,5 +1,6 @@
|
||||
import React, { useRef, useEffect } from 'react';
|
||||
import {useFormik} from 'formik';
|
||||
import toast from 'react-hot-toast';
|
||||
import * as Yup from 'yup';
|
||||
import Modal from 'components/Modal';
|
||||
import { useDispatch } from 'react-redux';
|
||||
@ -21,7 +22,8 @@ const NewFolder = ({collection, item, onClose}) => {
|
||||
}),
|
||||
onSubmit: (values) => {
|
||||
dispatch(newFolder(values.folderName, collection.uid, item ? item.uid : null))
|
||||
onClose();
|
||||
.then(() => onClose())
|
||||
.catch(() => toast.error("An error occured while adding the request"));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { useRef, useEffect } from 'react';
|
||||
import { useFormik } from 'formik';
|
||||
import * as Yup from 'yup';
|
||||
import toast from 'react-hot-toast';
|
||||
import { uuid } from 'utils/common';;
|
||||
import Modal from 'components/Modal';
|
||||
import { useDispatch } from 'react-redux';
|
||||
@ -38,10 +39,14 @@ const NewRequest = ({collection, item, isEphermal, onClose}) => {
|
||||
requestMethod: values.requestMethod,
|
||||
collectionUid: collection.uid
|
||||
}))
|
||||
dispatch(addTab({
|
||||
uid: uid,
|
||||
collectionUid: collection.uid
|
||||
}));
|
||||
.then(() => {
|
||||
dispatch(addTab({
|
||||
uid: uid,
|
||||
collectionUid: collection.uid
|
||||
}));
|
||||
onClose();
|
||||
})
|
||||
.catch(() => toast.error("An error occured while adding the request"));
|
||||
} else {
|
||||
dispatch(newHttpRequest({
|
||||
requestName: values.requestName,
|
||||
@ -50,9 +55,10 @@ const NewRequest = ({collection, item, isEphermal, onClose}) => {
|
||||
requestMethod: values.requestMethod,
|
||||
collectionUid: collection.uid,
|
||||
itemUid: item ? item.uid : null
|
||||
}));
|
||||
}))
|
||||
.then(() => onClose())
|
||||
.catch(() => toast.error("An error occured while adding the request"));
|
||||
}
|
||||
onClose();
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user