mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Panel index fix (#6255)
* Fix panel routing for part category index * Fix routing for stock location index
This commit is contained in:
parent
fa28697799
commit
8eec2f32c0
@ -23,7 +23,11 @@ import { useInstance } from '../../hooks/UseInstance';
|
||||
* Note: If no category ID is supplied, this acts as the top-level part category page
|
||||
*/
|
||||
export default function CategoryDetail({}: {}) {
|
||||
const { id } = useParams();
|
||||
const { id: _id } = useParams();
|
||||
const id = useMemo(
|
||||
() => (!isNaN(parseInt(_id || '')) ? _id : undefined),
|
||||
[_id]
|
||||
);
|
||||
|
||||
const [treeOpen, setTreeOpen] = useState(false);
|
||||
|
||||
@ -33,6 +37,7 @@ export default function CategoryDetail({}: {}) {
|
||||
instanceQuery
|
||||
} = useInstance({
|
||||
endpoint: ApiPaths.category_list,
|
||||
hasPrimaryKey: true,
|
||||
pk: id,
|
||||
params: {
|
||||
path_detail: true
|
||||
|
@ -13,7 +13,12 @@ import { ApiPaths } from '../../enums/ApiEndpoints';
|
||||
import { useInstance } from '../../hooks/UseInstance';
|
||||
|
||||
export default function Stock() {
|
||||
const { id } = useParams();
|
||||
const { id: _id } = useParams();
|
||||
|
||||
const id = useMemo(
|
||||
() => (!isNaN(parseInt(_id || '')) ? _id : undefined),
|
||||
[_id]
|
||||
);
|
||||
|
||||
const [treeOpen, setTreeOpen] = useState(false);
|
||||
|
||||
@ -23,6 +28,7 @@ export default function Stock() {
|
||||
instanceQuery
|
||||
} = useInstance({
|
||||
endpoint: ApiPaths.stock_location_list,
|
||||
hasPrimaryKey: true,
|
||||
pk: id,
|
||||
params: {
|
||||
path_detail: true
|
||||
|
@ -119,12 +119,12 @@ export const routes = (
|
||||
<Route path="user/*" element={<UserSettings />} />
|
||||
</Route>
|
||||
<Route path="part/">
|
||||
<Route index element={<Navigate to="category/" />} />
|
||||
<Route index element={<Navigate to="category/index/" />} />
|
||||
<Route path="category/:id?/*" element={<CategoryDetail />} />
|
||||
<Route path=":id/*" element={<PartDetail />} />
|
||||
</Route>
|
||||
<Route path="stock/">
|
||||
<Route index element={<Navigate to="location/" />} />
|
||||
<Route index element={<Navigate to="location/index/" />} />
|
||||
<Route path="location/:id?/*" element={<LocationDetail />} />
|
||||
<Route path="item/:id/*" element={<StockDetail />} />
|
||||
</Route>
|
||||
|
Loading…
Reference in New Issue
Block a user