Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 6fec456

Browse files
committed
add error page for 400/401 errors
1 parent dd46508 commit 6fec456

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from "react";
2+
import { Link, useLocation } from "react-router-dom";
3+
import { Container } from "react-bootstrap";
4+
5+
interface Props {
6+
needsLogin?: boolean;
7+
}
8+
9+
export default function Error400({ needsLogin }: Props) {
10+
const location = useLocation();
11+
const urlSearchParams = new URLSearchParams(location.search);
12+
const dest = urlSearchParams.get("dest");
13+
const message = urlSearchParams.get("message");
14+
15+
const tryAgainUrl = needsLogin
16+
? "/login?dest=" + dest
17+
: decodeURIComponent(dest ?? "");
18+
console.log(location);
19+
20+
return (
21+
<Container className={"text-center"}>
22+
<h2>Something went wrong!</h2>
23+
<h3>The file could not be loaded</h3>
24+
{message && <h4>{message}</h4>}
25+
{tryAgainUrl && (
26+
<p>
27+
<Link to={tryAgainUrl}>Try again</Link>
28+
</p>
29+
)}
30+
<Link to="/">Go to Home</Link>
31+
</Container>
32+
);
33+
}

0 commit comments

Comments
 (0)