mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-21 18:42:00 +00:00
- Added new omada-actions.ts file to handle fetching and updating device groups in Omada. - Updated authMiddleware to include new payment routes. - Enhanced createPayment function to add devices to a group upon successful payment verification. - Improved payment verification process to include device management. - Refactored PaymentsTable and DevicesToPay components for better UI and state handling. - Removed unused hasSession function from auth-guard.ts for cleaner code.
15 lines
340 B
TypeScript
15 lines
340 B
TypeScript
"use server";
|
|
import { auth } from "@/lib/auth";
|
|
import { headers } from "next/headers";
|
|
import { redirect } from "next/navigation";
|
|
|
|
export async function AdminAuthGuard() {
|
|
const session = await auth.api.getSession({
|
|
headers: await headers(),
|
|
});
|
|
if (session?.user.role !== "ADMIN") {
|
|
return redirect("/login");
|
|
}
|
|
return true;
|
|
}
|