refactor: update authentication flow to use NextAuth, replace better-auth with axios for API calls, and clean up unused code

This commit is contained in:
2025-03-23 15:07:03 +05:00
parent 0fd269df31
commit 020d74c5e2
23 changed files with 1269 additions and 1271 deletions

View File

@ -10,7 +10,7 @@ import {
SidebarProvider,
SidebarTrigger,
} from "@/components/ui/sidebar";
import { auth } from "@/lib/auth";
import { auth } from "@/app/auth";
import prisma from "@/lib/db";
import { headers } from "next/headers";
import { AccountPopover } from "./account-popver";
@ -19,7 +19,7 @@ export async function ApplicationLayout({
children,
}: { children: React.ReactNode }) {
const session = await auth.api.getSession({
headers: await headers()
headers: await headers(),
});
const billFormula = await prisma.billFormula.findFirst();
const user = await prisma.user.findFirst({

View File

@ -23,6 +23,7 @@ export default function LoginForm() {
<PhoneInput
id="phone-number"
name="phoneNumber"
className="b0rder"
maxLength={8}
disabled={isPending}
placeholder="Enter phone number"
@ -32,11 +33,7 @@ export default function LoginForm() {
{state.status === "error" && (
<p className="text-red-500 text-sm">{state.message}</p>
)}
<Button
className=""
disabled={isPending}
type="submit"
>
<Button className="" disabled={isPending} type="submit">
{isPending ? <Loader2 className="animate-spin" /> : "Request OTP"}
</Button>
</div>