Skip to content

Commit

Permalink
Merge pull request #1338 from syucream/fix/error-handler
Browse files Browse the repository at this point in the history
Remove dependency on react router from error handler
  • Loading branch information
userlocalhost authored Dec 9, 2024
2 parents 00c6594 + f578e52 commit 9a1d61c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions frontend/src/ErrorHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { styled } from "@mui/material/styles";
import React, { FC, useCallback, useEffect, useState } from "react";
import { ErrorBoundary, FallbackProps } from "react-error-boundary";
import { useNavigate } from "react-router-dom";
import { useError } from "react-use";

import { ForbiddenErrorPage } from "./pages/ForbiddenErrorPage";
Expand Down Expand Up @@ -46,16 +45,15 @@ interface GenericErrorProps {
}

const GenericError: FC<GenericErrorProps> = ({ children }) => {
const navigate = useNavigate();
const [open, setOpen] = useState(true);

const handleGoToTop = useCallback(() => {
navigate(topPath(), { replace: true });
}, [navigate]);
window.location.href = topPath();
}, []);

const handleReload = useCallback(() => {
navigate(0);
}, [navigate]);
window.location.reload();
}, []);

return (
<Dialog open={open} onClose={() => setOpen(false)}>
Expand Down

0 comments on commit 9a1d61c

Please sign in to comment.