fix(ui): sessionPath to go back from player

This commit is contained in:
Shekar Siri 2023-10-31 16:50:45 +01:00
parent 325d893db5
commit ae46d1ecbe
2 changed files with 6 additions and 4 deletions

View file

@ -53,7 +53,8 @@ const Router: React.FC<RouterProps> = (props) => {
fetchUserInfo,
fetchSiteList,
history,
match: { params: { siteId: siteIdFromPath } }
match: { params: { siteId: siteIdFromPath } },
setSessionPath,
} = props;
const [isIframe, setIsIframe] = React.useState(false);
const [isJwt, setIsJwt] = React.useState(false);
@ -69,8 +70,6 @@ const Router: React.FC<RouterProps> = (props) => {
if (!isLoggedIn && location.pathname !== routes.login()) {
localStorage.setItem(GLOBAL_DESTINATION_PATH, location.pathname);
}
setSessionPath(location);
};
const handleUserLogin = async () => {
@ -98,6 +97,9 @@ const Router: React.FC<RouterProps> = (props) => {
useEffect(() => {
handleJwtFromUrl();
handleDestinationPath();
setSessionPath(previousLocation ? previousLocation : location);
}, [location]);
useEffect(() => {
@ -126,6 +128,7 @@ const Router: React.FC<RouterProps> = (props) => {
}
const prevIsLoggedIn = usePrevious(isLoggedIn);
const previousLocation = usePrevious(location);
const hideHeader = (location.pathname && location.pathname.includes('/session/')) ||
location.pathname.includes('/assist/') || location.pathname.includes('multiview');

View file

@ -51,7 +51,6 @@ function PlayerBlockHeader(props: any) {
}, []);
const backHandler = () => {
history.goBack();
if (
sessionPath.pathname === history.location.pathname ||
sessionPath.pathname.includes('/session/')