Skip to content

Commit

Permalink
Replacing navigation on missing router with setting href
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasvoelcker committed Apr 5, 2024
1 parent 50705e6 commit f9cf24a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/utils/api.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import axios from 'axios';
import { toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { uriLogin } from './endpoints.jsx';

const configs = {
withCredentials: true
Expand All @@ -24,7 +25,7 @@ const handleError = err => {
if (err.response && err.response.status < 500) {
if (err.response.status === 401 || err.response.status === 403) {
localStorage.setItem('toastMessage', error.message);
this.props.router.navigate({ pathname: '/ui/login' }, { replace: true });
location.href = uriLogin();
} else {
toast.warn(error.message);
}
Expand Down

0 comments on commit f9cf24a

Please sign in to comment.