From f6ba51260fac9a9e260257566ce1192a20550b86 Mon Sep 17 00:00:00 2001 From: Hugo FOYART <11079152+foyarash@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:10:17 +0100 Subject: [PATCH] feat: redirect to first resource if dashboard doesnt exist (#195) --- .changeset/wicked-chicken-attack.md | 5 +++++ .../next-admin/src/components/Dashboard.tsx | 20 ++++++++++++++++--- .../next-admin/src/components/NextAdmin.tsx | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .changeset/wicked-chicken-attack.md diff --git a/.changeset/wicked-chicken-attack.md b/.changeset/wicked-chicken-attack.md new file mode 100644 index 00000000..5d1b580d --- /dev/null +++ b/.changeset/wicked-chicken-attack.md @@ -0,0 +1,5 @@ +--- +"@premieroctet/next-admin": minor +--- + +feat: redirect to first resource if dashboard doesnt exist diff --git a/packages/next-admin/src/components/Dashboard.tsx b/packages/next-admin/src/components/Dashboard.tsx index 21e07243..e416bc63 100644 --- a/packages/next-admin/src/components/Dashboard.tsx +++ b/packages/next-admin/src/components/Dashboard.tsx @@ -1,7 +1,21 @@ -export type DashboardProps = {}; +"use client"; +import { useConfig } from "../context/ConfigContext"; +import { useRouterInternal } from "../hooks/useRouterInternal"; +import { ModelName } from "../types"; -const Dashboard = ({}: DashboardProps) => { - return