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,9 +1,5 @@
import LoginForm from "@/components/auth/login-form";
import { auth } from "@/app/auth";
import { headers } from "next/headers";
import Image from "next/image";
import { redirect } from "next/navigation";
import React from "react";
export default async function LoginPage() {
return (

View File

@ -1,12 +1,10 @@
import { authOptions } from "@/app/auth";
import { DevicesTable } from "@/components/devices-table";
import Search from "@/components/search";
import AddDeviceDialogForm from "@/components/user/add-device-dialog";
import { getCurrentUser } from "@/lib/auth-utils";
import { getServerSession } from "next-auth";
import React, { Suspense } from "react";
export default async function Devices({
searchParams,
}: {
@ -18,14 +16,12 @@ export default async function Devices({
}>;
}) {
const query = (await searchParams)?.query || "";
const user = await getCurrentUser()
const session = await getServerSession(authOptions);
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">
<h3 className="text-sarLinkOrange text-2xl">
My Devices
</h3>
<AddDeviceDialogForm user_id={user?.id} />
<h3 className="text-sarLinkOrange text-2xl">My Devices</h3>
<AddDeviceDialogForm user_id={session?.user?.id} />
</div>
<div
@ -33,7 +29,6 @@ export default async function Devices({
className=" pb-4 gap-4 flex sm:flex-row flex-col items-start justify-start"
>
<Search />
</div>
<Suspense key={query} fallback={"loading...."}>
<DevicesTable parentalControl={false} searchParams={searchParams} />