feat: add logic to handle saving collection settings on shortcut (preview mode) (#3145)

This commit is contained in:
Pragadesh-45 2024-09-20 14:12:19 +05:30 committed by GitHub
parent dd2b93e8cd
commit e019a96cd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,7 @@ import SaveRequest from 'components/RequestPane/SaveRequest';
import EnvironmentSettings from 'components/Environments/EnvironmentSettings'; import EnvironmentSettings from 'components/Environments/EnvironmentSettings';
import NetworkError from 'components/ResponsePane/NetworkError'; import NetworkError from 'components/ResponsePane/NetworkError';
import NewRequest from 'components/Sidebar/NewRequest'; import NewRequest from 'components/Sidebar/NewRequest';
import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collections/actions'; import { sendRequest, saveRequest, saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions';
import { findCollectionByUid, findItemInCollection } from 'utils/collections'; import { findCollectionByUid, findItemInCollection } from 'utils/collections';
import { closeTabs, switchTab } from 'providers/ReduxStore/slices/tabs'; import { closeTabs, switchTab } from 'providers/ReduxStore/slices/tabs';
@ -54,6 +54,8 @@ export const HotkeysProvider = (props) => {
const item = findItemInCollection(collection, activeTab.uid); const item = findItemInCollection(collection, activeTab.uid);
if (item && item.uid) { if (item && item.uid) {
dispatch(saveRequest(activeTab.uid, activeTab.collectionUid)); dispatch(saveRequest(activeTab.uid, activeTab.collectionUid));
} else if (activeTab.type === 'collection-settings') {
dispatch(saveCollectionRoot(collection.uid));
} else { } else {
// todo: when ephermal requests go live // todo: when ephermal requests go live
// setShowSaveRequestModal(true); // setShowSaveRequestModal(true);