mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-20 11:48:03 +02: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 React, { useRef, useEffect } from 'react';
|
||||||
import {useFormik} from 'formik';
|
import {useFormik} from 'formik';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import Modal from 'components/Modal';
|
import Modal from 'components/Modal';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
@ -21,7 +22,8 @@ const NewFolder = ({collection, item, onClose}) => {
|
|||||||
}),
|
}),
|
||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
dispatch(newFolder(values.folderName, collection.uid, item ? item.uid : null))
|
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 React, { useRef, useEffect } from 'react';
|
||||||
import { useFormik } from 'formik';
|
import { useFormik } from 'formik';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
import { uuid } from 'utils/common';;
|
import { uuid } from 'utils/common';;
|
||||||
import Modal from 'components/Modal';
|
import Modal from 'components/Modal';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
@ -38,10 +39,14 @@ const NewRequest = ({collection, item, isEphermal, onClose}) => {
|
|||||||
requestMethod: values.requestMethod,
|
requestMethod: values.requestMethod,
|
||||||
collectionUid: collection.uid
|
collectionUid: collection.uid
|
||||||
}))
|
}))
|
||||||
dispatch(addTab({
|
.then(() => {
|
||||||
uid: uid,
|
dispatch(addTab({
|
||||||
collectionUid: collection.uid
|
uid: uid,
|
||||||
}));
|
collectionUid: collection.uid
|
||||||
|
}));
|
||||||
|
onClose();
|
||||||
|
})
|
||||||
|
.catch(() => toast.error("An error occured while adding the request"));
|
||||||
} else {
|
} else {
|
||||||
dispatch(newHttpRequest({
|
dispatch(newHttpRequest({
|
||||||
requestName: values.requestName,
|
requestName: values.requestName,
|
||||||
@ -50,9 +55,10 @@ const NewRequest = ({collection, item, isEphermal, onClose}) => {
|
|||||||
requestMethod: values.requestMethod,
|
requestMethod: values.requestMethod,
|
||||||
collectionUid: collection.uid,
|
collectionUid: collection.uid,
|
||||||
itemUid: item ? item.uid : null
|
itemUid: item ? item.uid : null
|
||||||
}));
|
}))
|
||||||
|
.then(() => onClose())
|
||||||
|
.catch(() => toast.error("An error occured while adding the request"));
|
||||||
}
|
}
|
||||||
onClose();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user