Wrap admin pages with AdminGuard component

The AdminGuard component has been added to the AccountPage, AccountsPage, and AdminPage in the web app. This server-side implementation ensures that these pages are only accessible to super-admin users. If a user is not a super-admin, the guard will trigger a redirect to a 404 page.
This commit is contained in:
giancarlo
2024-04-08 14:39:02 +08:00
parent 4655f56143
commit 45417fe2c5
4 changed files with 19 additions and 4 deletions

View File

@@ -1,7 +1,8 @@
import { AdminDashboard } from '@kit/admin/components/admin-dashboard';
import { AdminGuard } from '@kit/admin/components/admin-guard';
import { PageBody, PageHeader } from '@kit/ui/page';
export default function AdminPage() {
function AdminPage() {
return (
<>
<PageHeader title={'Admin'} description={`Your SaaS stats at a glance`} />
@@ -12,3 +13,5 @@ export default function AdminPage() {
</>
);
}
export default AdminGuard(AdminPage);