Snai3i-LandingPage-FormBuilder / frontend / src / hooks / useStorm.ts
useStorm.ts
Raw
import { useDispatch, useSelector } from "react-redux";
import { allowAccess, disallowAccess } from "@/app/slices/stormAccess";
import { RootState } from "@/app/store";

function useStorm() {
  const dispatch = useDispatch();
  const access = useSelector((state: RootState) => state.stormAccess);
  const allow = () => {
    dispatch(allowAccess());
  };
  const disallow = () => {
    dispatch(disallowAccess());
  };
  return { allowAccess: allow, disallowAccess: disallow, access: access };
}
export default useStorm;