Appbar: make sure it changes when the location changes.

master
Tom Hacohen 4 years ago
parent b804a8945d
commit 1b73899182

@ -99,15 +99,16 @@ interface AppBarPropsType {
} }
function AppBarWitHistory(props: AppBarPropsType) { function AppBarWitHistory(props: AppBarPropsType) {
const location = useLocation();
const history = useHistory(); const history = useHistory();
function canGoBack() { function canGoBack() {
return ( return (
(history!.length > 1) && (history!.length > 1) &&
(history!.location.pathname !== routeResolver.getRoute("pim.contacts")) && (location.pathname !== routeResolver.getRoute("pim.contacts")) &&
(history!.location.pathname !== routeResolver.getRoute("pim.events")) && (location.pathname !== routeResolver.getRoute("pim.events")) &&
(history!.location.pathname !== routeResolver.getRoute("pim.tasks")) && (location.pathname !== routeResolver.getRoute("pim.tasks")) &&
(history!.location.pathname !== routeResolver.getRoute("home")) (location.pathname !== routeResolver.getRoute("home"))
); );
} }

Loading…
Cancel
Save