@datalayer/core
Version:
**Datalayer Core**
23 lines (22 loc) • 676 B
JavaScript
/*
* Copyright (c) 2023-2025 Datalayer, Inc.
* Distributed under the terms of the Modified BSD License.
*/
import { useLocation, useParams } from "react-router-dom";
import { useRunStore } from "../state";
export const useLocationHandles = () => {
const { accountHandle, spaceHandle } = useParams();
const { pathname } = useLocation();
const runStore = useRunStore();
if (pathname.startsWith("/public")) {
return {
accountHandle: runStore.iam().user?.handle,
spaceHandler: runStore.layout().space?.handle,
};
}
return {
accountHandle,
spaceHandle,
};
};
export default useLocationHandles;