saleor-dashboard/src/apps/hooks/useLocationState.ts
Dawid 079c25f16d
Fix app iframe resolution (#2111)
* Fix app frame sizes

* Update app frame height

* App page functions refactor

* Move useLocationState hook to apps

* Update apps test snapshots
2022-06-30 11:05:09 +02:00

18 lines
411 B
TypeScript

import { appsSection } from "@saleor/apps/urls";
import { matchPath, useLocation } from "react-router";
const isAppPath = (pathname: string) =>
!!matchPath(pathname, {
path: `${appsSection}:id`,
});
/*
* Use detailed information about the current location.
*/
export const useLocationState = () => {
const location = useLocation();
return {
isAppPath: isAppPath(location.pathname),
};
};