refactor: streamline authentication flow by removing unused code, replacing custom auth utilities with NextAuth, and updating session handling in components
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 5m56s

This commit is contained in:
2025-03-28 22:24:45 +05:00
parent 99c5fef748
commit ef9f032366
10 changed files with 291 additions and 323 deletions

View File

@ -1,6 +1,5 @@
"use server";
import prisma from "@/lib/db";
import type { GroupProfile, MacAddress, OmadaResponse } from "@/lib/types";
import { formatMacAddress } from "@/lib/utils";
import { revalidatePath } from "next/cache";
@ -124,11 +123,11 @@ export async function blockDevice({
if (!macAddress) {
throw new Error("macAddress is a required parameter");
}
const device = await prisma.device.findFirst({
where: {
mac: macAddress,
},
});
// const device = await prisma.device.findFirst({
// where: {
// mac: macAddress,
// },
// });
try {
const baseUrl: string = process.env.OMADA_BASE_URL || "";
const url: string = `${baseUrl}/api/v2/sites/${process.env.OMADA_SITE_ID}/cmd/clients/${formatMacAddress(macAddress)}/${type}`;
@ -146,16 +145,16 @@ export async function blockDevice({
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
await prisma.device.update({
where: {
id: device?.id,
},
data: {
reasonForBlocking: type === "block" ? reason : "",
blocked: type === "block",
blockedBy: blockedBy,
},
});
// await prisma.device.update({
// where: {
// id: device?.id,
// },
// data: {
// reasonForBlocking: type === "block" ? reason : "",
// blocked: type === "block",
// blockedBy: blockedBy,
// },
// });
revalidatePath("/parental-control");
} catch (error) {
console.error("Error blocking device:", error);