Skip to content
Extraits de code Groupes Projets
Valider ece4d041 rédigé par Maverick Chardet's avatar Maverick Chardet
Parcourir les fichiers

Only warn before unload if is dirty

parent 25ca4d67
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
import { FC, useEffect } from "react";
import { useCanSave } from "./hooks";
import { useAppSelector } from "../../app/hooks";
import { selectIsDirty } from "./activityDataSlice";
const ExitWarning: FC = () => {
const canSave = useCanSave();
const isDirty = useAppSelector(selectIsDirty);
useEffect(() => {
const handleBeforeUnload = (e: BeforeUnloadEvent) => {
if (canSave) {
if (canSave && isDirty) {
e.preventDefault();
e.returnValue = true;
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter