mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
fetch table settings/collection based on route
This commit is contained in:
5
src/hooks/useRouter.ts
Normal file
5
src/hooks/useRouter.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { useContext } from "react";
|
||||
import { __RouterContext } from "react-router";
|
||||
export default function useRouter() {
|
||||
return useContext(__RouterContext);
|
||||
}
|
||||
@@ -4,14 +4,17 @@ import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Navigation } from "../components/Navigation";
|
||||
import useTable from "../hooks/useTable";
|
||||
import Table from "../components/Table";
|
||||
|
||||
import useRouter from "../hooks/useRouter";
|
||||
import useTableConfig from "../hooks/useTableConfig";
|
||||
const useStyles = makeStyles({});
|
||||
|
||||
export default function AuthView() {
|
||||
const router = useRouter();
|
||||
const tableCollection = router.location.pathname.split("/")[2];
|
||||
console.log(tableCollection);
|
||||
const classes = useStyles();
|
||||
const tableConfig = useTableConfig("founders");
|
||||
const [table] = useTable({ path: "founders" });
|
||||
const tableConfig = useTableConfig(tableCollection);
|
||||
const [table] = useTable({ path: tableCollection });
|
||||
return (
|
||||
<Navigation>
|
||||
<Table columns={tableConfig.columns} rows={table.rows} />
|
||||
|
||||
Reference in New Issue
Block a user