mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-03 06:48:21 +00:00
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
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 8m9s
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
import { authOptions } from "@/app/auth";
|
||||
import { PaymentsTable } from "@/components/payments-table";
|
||||
import Search from "@/components/search";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import { Suspense } from "react";
|
||||
|
||||
export default async function Devices({
|
||||
export default async function Payments({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{
|
||||
@ -13,6 +16,10 @@ export default async function Devices({
|
||||
}>;
|
||||
}) {
|
||||
const query = (await searchParams)?.query || "";
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.user?.is_admin) {
|
||||
return redirect("/user-payments");
|
||||
}
|
||||
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">
|
||||
|
Reference in New Issue
Block a user