import React from 'react'; import classnames from 'classnames'; import get from 'lodash/get'; import cloneDeep from 'lodash/cloneDeep'; import toast from 'react-hot-toast'; import { updateBrunoConfig } from 'providers/ReduxStore/slices/collections/actions'; import { updateSettingsSelectedTab } from 'providers/ReduxStore/slices/collections'; import { useDispatch } from 'react-redux'; import ProxySettings from './ProxySettings'; import Headers from './Headers'; import Auth from './Auth'; import Script from './Script'; import Test from './Tests'; import StyledWrapper from './StyledWrapper'; const CollectionSettings = ({ collection }) => { const dispatch = useDispatch(); const tab = collection.settingsSelectedTab; const setTab = (tab) => { dispatch( updateSettingsSelectedTab({ collectionUid: collection.uid, tab }) ); }; const proxyConfig = get(collection, 'brunoConfig.proxy', {}); const onProxySettingsUpdate = (config) => { const brunoConfig = cloneDeep(collection.brunoConfig); brunoConfig.proxy = config; dispatch(updateBrunoConfig(brunoConfig, collection.uid)) .then(() => { toast.success('Collection settings updated successfully'); }) .catch((err) => console.log(err) && toast.error('Failed to update collection settings')); }; const getTabPanel = (tab) => { switch (tab) { case 'headers': { return ; } case 'auth': { return ; } case 'script': { return