Add user rejection and device addition functionalities

- Implemented Rejectuser function to delete a user and send rejection details via SMS.
- Added SendUserRejectionDetailSMS function for SMS notifications.
- Introduced AddDevice function to create new devices associated with users.
- Updated user-actions.ts to include new functionalities and improve user management.
- Refactored auth-guard.ts to ensure proper session handling for admin access.
This commit is contained in:
2024-12-01 23:16:54 +05:00
parent 3f8bb4e70a
commit 2cbf9fb773
2 changed files with 70 additions and 4 deletions

View File

@ -1,11 +1,12 @@
"use server";
import { auth } from "@/lib/auth";
import { redirect } from "next/navigation";
import { headers } from "next/headers";
import { redirect } from "next/navigation";
const session = await auth.api.getSession({
headers: await headers(),
});
export async function AdminAuthGuard() {
const session = await auth.api.getSession({
headers: await headers(),
});
if (session?.user.role !== "ADMIN") {
return redirect("/login");
}