Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit c99dfc9

Browse files
committed
changes for #259
1 parent 6a10b8e commit c99dfc9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

client/src/services/api.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import axios from "axios";
77

88
import { useAuth0 } from "../react-auth0-spa";
99

10+
import Cookies from "js-cookie";
11+
1012
export default () => {
1113
const { getTokenSilently, loginWithRedirect } = useAuth0();
1214
const api = useRef(
@@ -17,6 +19,15 @@ export default () => {
1719
})
1820
);
1921
useEffect(() => {
22+
const cookie = Cookies.get('auth0.is.authenticated');
23+
if (cookie && cookie === 'true') {
24+
// Do nothing
25+
} else {
26+
loginWithRedirect({
27+
redirect_uri: window.location.origin,
28+
});
29+
return;
30+
}
2031
const currentAPI = api.current;
2132
currentAPI.interceptors.request.use(async (config) => {
2233
let token;

0 commit comments

Comments
 (0)