Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions frontend/app/forgot-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useState } from "react";
import Link from "next/link";
import Image from "next/image";
import { BASE_URL } from "@/lib/api/client";
import { useRouter } from "next/navigation";
import AuthCardShell, {
AuthCardInner,
Expand All @@ -12,11 +13,6 @@ import { Button } from "@/components/ui/button";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { AlertCircle, CheckCircle2, ArrowLeft, Loader2 } from "lucide-react";

const BASE_URL =
process.env.NEXT_PUBLIC_GATEWAY ??
process.env.NEXT_PUBLIC_API_URL ??
"http://localhost:8080";

const INPUT_CLASS =
"h-[50px] rounded-[13px] border border-[rgba(209,207,201,0.9)] dark:border-darkcardborder bg-[#F2F1EE] dark:bg-white/5 px-4 font-sans font-medium text-[14px] text-ink dark:text-white shadow-none focus-visible:ring-2 focus-visible:ring-saral-forest/30 focus-visible:border-saral-forest placeholder:text-ink-faint dark:placeholder:text-white/40";

Expand Down Expand Up @@ -50,8 +46,8 @@ export default function ForgotPasswordPage() {
const data = await res.json().catch(() => ({}));
setError(
data?.error?.message ??
data?.message ??
"Too many attempts. Please try again later.",
data?.message ??
"Too many attempts. Please try again later.",
);
return;
}
Expand Down
12 changes: 4 additions & 8 deletions frontend/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Fragment, useEffect, useState } from "react";
import Link from "next/link";
import Image from "next/image";
import { BASE_URL } from "@/lib/api/client";
import { useRouter } from "next/navigation";
import {
GoogleAuthProvider,
Expand Down Expand Up @@ -38,11 +39,6 @@ import {
EyeOff,
} from "lucide-react";

const BASE_URL =
process.env.NEXT_PUBLIC_GATEWAY ??
process.env.NEXT_PUBLIC_API_URL ??
"http://localhost:8080";

// ── Provider instances (unchanged) ─────────────────────────────────────────────
const googleProvider = new GoogleAuthProvider();
const githubProvider = new GithubAuthProvider();
Expand Down Expand Up @@ -194,7 +190,7 @@ export default function LoginPage() {
if (!existingProviderId || !existingProvider) {
setError(
"This email is already registered with a different sign-in method. " +
"Try Google, GitHub, or Microsoft — whichever you used first.",
"Try Google, GitHub, or Microsoft — whichever you used first.",
);
setLoadingId(null);
return;
Expand Down Expand Up @@ -262,8 +258,8 @@ export default function LoginPage() {
} else {
setEmailError(
data?.error?.message ??
data?.message ??
"Sign-in failed. Please try again.",
data?.message ??
"Sign-in failed. Please try again.",
);
}
return;
Expand Down
6 changes: 1 addition & 5 deletions frontend/app/reset-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useRouter, useSearchParams } from "next/navigation";
import AuthCardShell, {
AuthCardInner,
} from "@/components/auth/auth-card-shell";
import { BASE_URL } from "@/lib/api/client";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { Alert, AlertDescription } from "@/components/ui/alert";
Expand All @@ -21,11 +22,6 @@ import {
XCircle,
} from "lucide-react";

const BASE_URL =
process.env.NEXT_PUBLIC_GATEWAY ??
process.env.NEXT_PUBLIC_API_URL ??
"http://localhost:8080";

const INPUT_CLASS =
"h-[50px] rounded-[13px] border border-[rgba(209,207,201,0.9)] dark:border-darkcardborder bg-[#F2F1EE] dark:bg-white/5 px-4 font-sans font-medium text-[14px] text-ink dark:text-white shadow-none focus-visible:ring-2 focus-visible:ring-saral-forest/30 focus-visible:border-saral-forest placeholder:text-ink-faint dark:placeholder:text-white/40";

Expand Down
6 changes: 1 addition & 5 deletions frontend/app/signup/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useRouter } from "next/navigation";
import { useAuthStore } from "@/lib/auth-store";
import AuthShell from "@/components/auth/auth-shell";
import { Input } from "@/components/ui/input";
import { BASE_URL } from "@/lib/api/client";
import { Button } from "@/components/ui/button";
import { Alert, AlertDescription } from "@/components/ui/alert";
import {
Expand All @@ -17,11 +18,6 @@ import {
XCircle,
} from "lucide-react";

const BASE_URL =
process.env.NEXT_PUBLIC_GATEWAY ??
process.env.NEXT_PUBLIC_API_URL ??
"http://localhost:8080";

const INPUT_CLASS =
"h-[50px] rounded-[13px] border border-[rgba(209,207,201,0.9)] dark:border-darkcardborder bg-[#F2F1EE] dark:bg-white/5 px-4 font-sans font-medium text-[14px] text-ink dark:text-white shadow-none focus-visible:ring-2 focus-visible:ring-saral-forest/30 focus-visible:border-saral-forest placeholder:text-ink-faint dark:placeholder:text-white/40";

Expand Down
5 changes: 2 additions & 3 deletions frontend/components/auth/auth-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Image from "next/image";
import { GoogleAuthProvider, signInWithPopup } from "firebase/auth";
import { auth, isFirebaseConfigured } from "@/lib/firebase";
import { useAuthStore } from "@/lib/auth-store";
import { BASE_URL } from "@/lib/api/client";
import {
GoogleIcon,
MicrosoftIcon,
Expand Down Expand Up @@ -58,12 +59,10 @@ export default function AuthShell({
"Firebase is not configured. Add the NEXT_PUBLIC_FIREBASE_* environment variables and restart the dev server.",
);
}

const result = await signInWithPopup(auth, provider);
const token = await result.user.getIdToken();

const res = await fetch(
`${process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8080"}/auth/login`,
`${BASE_URL}/auth/login`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
Expand Down