All files / src/features/ChangeLog/hooks useChanglelogModal.tsx

100% Statements 8/8
50% Branches 1/2
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27              116x     1543x   1543x   1543x 62x 62x 62x       1543x          
import { useAppSelector, useAppDispatch } from "@redux/hooks";
import {
  resetChangelogState,
  selectChangelog,
  setModalOpenChangelog,
} from "@redux/slices/changelog";
 
export const useChangelogModal = () => {
  const {
    modal: { isOpen },
  } = useAppSelector(selectChangelog);
 
  const dispatch = useAppDispatch();
 
  const handleOpenChangelogModal = (open?: boolean) => {
    dispatch(setModalOpenChangelog(!!open));
    Eif (!open) {
      dispatch(resetChangelogState());
    }
  };
 
  return {
    handleOpenChangelogModal,
    isOpen,
  };
};