Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fixed a TS error

Vladyslav Matsiiako77cb20f5c76b
diff --git a/frontend/src/hooks/useLeaveConfirm.tsx b/frontend/src/hooks/useLeaveConfirm.tsx
index 9a64f7a4de..e136f41e41 100644
--- a/frontend/src/hooks/useLeaveConfirm.tsx
+++ b/frontend/src/hooks/useLeaveConfirm.tsx
@@ -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);
diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx
index c2a8dab217..d0dda02402 100644
--- a/frontend/src/pages/dashboard/[id].tsx
+++ b/frontend/src/pages/dashboard/[id].tsx
@@ -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) || {