mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
completely removed modal reducer
This commit is contained in:
parent
b1e8bddbaf
commit
8d5afb4f98
34 changed files with 189 additions and 300 deletions
|
@ -1,13 +1,18 @@
|
|||
import { useCallback } from 'react';
|
||||
import { IFile } from '~/redux/types';
|
||||
import { modalShowPhotoswipe } from '~/redux/modal/actions';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { usePhotoSwipeStore } from '~/store/photoSwipe/usePhotoSwipeStore';
|
||||
import { useShowModal } from '~/hooks/modal/useShowModal';
|
||||
import { Dialog } from '~/constants/modal';
|
||||
|
||||
export const useImageModal = () => {
|
||||
const dispatch = useDispatch();
|
||||
const { setData } = usePhotoSwipeStore();
|
||||
const showModal = useShowModal(Dialog.Photoswipe);
|
||||
|
||||
return useCallback(
|
||||
(images: IFile[], index: number) => dispatch(modalShowPhotoswipe(images, index)),
|
||||
[dispatch]
|
||||
(images: IFile[], index: number) => {
|
||||
setData(images, index);
|
||||
showModal();
|
||||
},
|
||||
[setData, showModal]
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue