
* Fix app frame sizes * Update app frame height * App page functions refactor * Move useLocationState hook to apps * Update apps test snapshots
18 lines
411 B
TypeScript
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),
|
|
};
|
|
};
|