mirror of
https://github.com/kyantech/Palmr.git
synced 2025-10-23 06:11:58 +00:00
refactor: streamline authentication and password handling
- Removed unnecessary parameters from the GET request in the auth config route. - Adjusted import order in the forgot password hook for consistency. - Cleaned up password validation logic in the login schema for better readability.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333";
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
export async function GET() {
|
||||
try {
|
||||
const url = `${API_BASE_URL}/auth/config`;
|
||||
|
||||
|
@@ -9,7 +9,7 @@ import { useForm } from "react-hook-form";
|
||||
import { toast } from "sonner";
|
||||
import { z } from "zod";
|
||||
|
||||
import { requestPasswordReset, getAuthConfig } from "@/http/endpoints";
|
||||
import { getAuthConfig, requestPasswordReset } from "@/http/endpoints";
|
||||
|
||||
export type ForgotPasswordFormData = {
|
||||
email: string;
|
||||
|
@@ -6,9 +6,7 @@ type TFunction = ReturnType<typeof useTranslations>;
|
||||
export const createLoginSchema = (t: TFunction, passwordAuthEnabled: boolean = true) =>
|
||||
z.object({
|
||||
emailOrUsername: z.string().min(1, t("validation.emailOrUsernameRequired")),
|
||||
password: passwordAuthEnabled
|
||||
? z.string().min(1, t("validation.passwordRequired"))
|
||||
: z.string().optional(),
|
||||
password: passwordAuthEnabled ? z.string().min(1, t("validation.passwordRequired")) : z.string().optional(),
|
||||
});
|
||||
|
||||
export type LoginFormValues = z.infer<ReturnType<typeof createLoginSchema>>;
|
||||
|
Reference in New Issue
Block a user