Fix unauthenticated redirects
This commit is contained in:
@@ -16,7 +16,7 @@ limitations under the License.
|
||||
|
||||
import React from "react";
|
||||
import {
|
||||
HashRouter as Router,
|
||||
BrowserRouter as Router,
|
||||
Switch,
|
||||
Route,
|
||||
Redirect,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { Center, Content, Modal } from "./Layout";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import { ErrorMessage } from "./Input";
|
||||
import styles from "./ErrorModal.module.css";
|
||||
|
||||
export function ErrorModal({ error }) {
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
@@ -17,10 +19,14 @@ export function ErrorModal({ error }) {
|
||||
<div className={styles.errorModalContent}>
|
||||
<ErrorMessage>{error.message}</ErrorMessage>
|
||||
<p>
|
||||
<Link to="/login">Login</Link>
|
||||
<Link to={{ pathname: "/login", state: { from: location } }}>
|
||||
Login
|
||||
</Link>
|
||||
</p>
|
||||
<p>
|
||||
<Link to="/register">Register</Link>
|
||||
<Link to={{ pathname: "/register", state: { from: location } }}>
|
||||
Register
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user