mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Fixed a TS error
This commit is contained in:
@@ -22,11 +22,12 @@ export function useLeaveConfirm({
|
||||
|
||||
const onRouteChangeStart = useCallback(() => {
|
||||
if (hasUnsavedChanges) {
|
||||
if (confirm(message)) {
|
||||
if (window.confirm(message)) {
|
||||
return true
|
||||
}
|
||||
throw "Abort route change by user's confirmation."
|
||||
throw new Error("Abort route change by user's confirmation.")
|
||||
}
|
||||
return false;
|
||||
}, [hasUnsavedChanges])
|
||||
|
||||
const handleWindowClose = useCallback((e: any) => {
|
||||
@@ -35,7 +36,7 @@ export function useLeaveConfirm({
|
||||
}
|
||||
e.preventDefault();
|
||||
e.returnValue = message;
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
router.events.on("routeChangeStart", onRouteChangeStart);
|
||||
|
||||
@@ -561,8 +561,7 @@ export default function Dashboard() {
|
||||
|
||||
const handleOnEnvironmentChange = (envName: string) => {
|
||||
if(hasUnsavedChanges) {
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
if (!confirm(leaveConfirmDefaultMessage)) return;
|
||||
if (!window.confirm(leaveConfirmDefaultMessage)) return;
|
||||
}
|
||||
|
||||
const selectedWorkspaceEnv = workspaceEnvs.find(({ name }: { name: string }) => envName === name) || {
|
||||
|
||||
Reference in New Issue
Block a user