mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 16:03:39 +01:00
refactor: Handle errors when importing collections (#2455)
This commit is contained in:
parent
693f882f5a
commit
5c04f884e2
@ -31,10 +31,17 @@ const TitleBar = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleImportCollectionLocation = (collectionLocation) => {
|
const handleImportCollectionLocation = (collectionLocation) => {
|
||||||
dispatch(importCollection(importedCollection, collectionLocation));
|
dispatch(importCollection(importedCollection, collectionLocation))
|
||||||
setImportCollectionLocationModalOpen(false);
|
.then(() => {
|
||||||
setImportedCollection(null);
|
setImportCollectionLocationModalOpen(false);
|
||||||
toast.success('Collection imported successfully');
|
setImportedCollection(null);
|
||||||
|
toast.success('Collection imported successfully');
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
setImportCollectionLocationModalOpen(false);
|
||||||
|
console.error(err);
|
||||||
|
toast.error('An error occurred while importing the collection. Check the logs for more information.');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const menuDropdownTippyRef = useRef();
|
const menuDropdownTippyRef = useRef();
|
||||||
|
@ -34,10 +34,17 @@ const Welcome = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleImportCollectionLocation = (collectionLocation) => {
|
const handleImportCollectionLocation = (collectionLocation) => {
|
||||||
dispatch(importCollection(importedCollection, collectionLocation));
|
dispatch(importCollection(importedCollection, collectionLocation))
|
||||||
setImportCollectionLocationModalOpen(false);
|
.then(() => {
|
||||||
setImportedCollection(null);
|
setImportCollectionLocationModalOpen(false);
|
||||||
toast.success('Collection imported successfully');
|
setImportedCollection(null);
|
||||||
|
toast.success('Collection imported successfully');
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
setImportCollectionLocationModalOpen(false);
|
||||||
|
console.error(err);
|
||||||
|
toast.error('An error occurred while importing the collection. Check the logs for more information.');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user