aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/Navigation.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/modern/src/Navigation.js b/modern/src/Navigation.js
index d37ca72c..3aa8a12c 100644
--- a/modern/src/Navigation.js
+++ b/modern/src/Navigation.js
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
-import { Route, Routes, useNavigate } from 'react-router-dom';
+import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import { LinearProgress } from '@mui/material';
import MainPage from './main/MainPage';
@@ -52,13 +52,14 @@ const Navigation = () => {
const [redirectsHandled, setRedirectsHandled] = useState(false);
+ const { pathname } = useLocation();
const query = useQuery();
useEffectAsync(async () => {
if (query.get('token')) {
const token = query.get('token');
await fetch(`/api/session?token=${encodeURIComponent(token)}`);
- navigate('/');
+ navigate(pathname);
} else if (query.get('deviceId')) {
const deviceId = query.get('deviceId');
const response = await fetch(`/api/devices?uniqueId=${deviceId}`);