feat: toast integration

This commit is contained in:
Anoop M D 2022-10-11 02:29:19 +05:30
parent 6476b47d53
commit adc6be031d
3 changed files with 5 additions and 0 deletions

View File

@ -32,6 +32,7 @@
"qs": "^6.11.0", "qs": "^6.11.0",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-hot-toast": "^2.4.0",
"react-redux": "^7.2.6", "react-redux": "^7.2.6",
"react-tabs": "^3.2.3", "react-tabs": "^3.2.3",
"sass": "^1.46.0", "sass": "^1.46.0",

View File

@ -3,6 +3,7 @@ import { useFormik } from 'formik';
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';
import toast from 'react-hot-toast';
import { renameCollection } from 'providers/ReduxStore/slices/collections/actions'; import { renameCollection } from 'providers/ReduxStore/slices/collections/actions';
const RenameCollection = ({collection, onClose}) => { const RenameCollection = ({collection, onClose}) => {
@ -21,6 +22,7 @@ const RenameCollection = ({collection, onClose}) => {
}), }),
onSubmit: (values) => { onSubmit: (values) => {
dispatch(renameCollection(values.name, collection.uid)); dispatch(renameCollection(values.name, collection.uid));
toast.success('Collection renamed!');
onClose(); onClose();
} }
}); });

View File

@ -3,6 +3,7 @@ import { AuthProvider } from 'providers/Auth';
import { AppProvider } from 'providers/App'; import { AppProvider } from 'providers/App';
import ReduxStore from 'providers/ReduxStore'; import ReduxStore from 'providers/ReduxStore';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { Toaster } from 'react-hot-toast';
import '../styles/globals.css' import '../styles/globals.css'
import 'tailwindcss/dist/tailwind.min.css'; import 'tailwindcss/dist/tailwind.min.css';
@ -42,6 +43,7 @@ function MyApp({ Component, pageProps }) {
<Provider store={ReduxStore}> <Provider store={ReduxStore}>
<AppProvider> <AppProvider>
<HotkeysProvider> <HotkeysProvider>
<Toaster toastOptions={{duration: 2000}}/>
<Component {...pageProps} /> <Component {...pageProps} />
</HotkeysProvider> </HotkeysProvider>
</AppProvider> </AppProvider>