backkey
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
useEffect,
|
||||
useState
|
||||
} from 'react';
|
||||
import { Outlet } from 'react-router-dom';
|
||||
import { Outlet, useLocation } from 'react-router-dom';
|
||||
import { HeaderNavigation } from '@/widgets/navigation/header';
|
||||
import { FooterNavigation } from '@/widgets/navigation/footer';
|
||||
import { PullToRefresh } from '@/widgets/pull-to-refresh/pull-to-refresh';
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
import { useHomeGroupsMutation } from '@/entities/home/api/use-home-groups-mutation';
|
||||
import { useUserInfo } from '@/entities/user/lib/use-user-info';
|
||||
import { useAppBridge } from '@/hooks';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { useMenuOnStore, useStore } from '@/shared/model/store';
|
||||
import { HomeGroupsParams, HomeGroupsResponse } from '@/entities/home/model/types';
|
||||
import {
|
||||
BusinessPropertyParams,
|
||||
@@ -67,7 +67,10 @@ export const SubLayout = () => {
|
||||
updateUserData
|
||||
} = useUserInfo();
|
||||
|
||||
const { reload } = useNavigate();
|
||||
const { reload, navigateBack } = useNavigate();
|
||||
const { menuOn, setMenuOn } = useMenuOnStore();
|
||||
const location = useLocation();
|
||||
console.log(location)
|
||||
|
||||
const [isPullToRefreshEnabled, setIsPullToRefreshEnabled] = useState(false);
|
||||
const [onBack, setOnBack] = useState(undefined);
|
||||
@@ -396,8 +399,19 @@ export const SubLayout = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const onPressBackKey = () => {
|
||||
let pathname = location.pathname;
|
||||
if(menuOn){
|
||||
setMenuOn(false);
|
||||
}
|
||||
else{
|
||||
navigateBack();
|
||||
}
|
||||
};
|
||||
|
||||
window.saveToken = saveToken;
|
||||
window.alarmLink = alarmLink;
|
||||
window.onPressBackKey = onPressBackKey;
|
||||
|
||||
useEffect(() => {
|
||||
handleLogin();
|
||||
|
||||
Reference in New Issue
Block a user