feat: add admin check for device and payment pages; update session type to include is_admin property
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 8m9s

This commit is contained in:
2025-06-26 11:36:34 +05:00
parent fb3ad136bc
commit 6aea54884d
3 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import { DevicesTable } from "@/components/devices-table";
import Search from "@/components/search";
import AddDeviceDialogForm from "@/components/user/add-device-dialog";
import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";
import React, { Suspense } from "react";
import DevicesTableSkeleton from "./device-table-skeleton";
@ -17,6 +18,7 @@ export default async function Devices({
const query = (await searchParams)?.query || "";
const page = (await searchParams)?.page || 1;
const session = await getServerSession(authOptions);
if (session?.user?.is_admin) return redirect("/user-devices");
return (
<div>
<div className="flex justify-between items-center border-[1px] rounded-md border-dashed font-bold title-bg py-4 px-2 mb-4">