260121_01_ENH : client env 정규화 및 로그인 페이지 오류 수정
This commit is contained in:
@@ -6,7 +6,7 @@ import {Card, CardContent, CardHeader} from "@/components/ui/card";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import React, {useEffect, useRef, useState} from "react";
|
||||
import { nextApi } from "@/lib/http-client";
|
||||
import {useRouter, useSearchParams} from "next/navigation";
|
||||
import {useSearchParams} from "next/navigation";
|
||||
import {LoginUser} from "@/types/auth";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { useLoading } from "@/hooks/useLoading";
|
||||
@@ -35,12 +35,15 @@ const LoginPage = () => {
|
||||
const tryLogin = () => {
|
||||
if(!userId){
|
||||
alert("아이디를 입력해 주세요");
|
||||
return;
|
||||
}
|
||||
if(!userPw){
|
||||
alert("PW를 입력해 주세요");
|
||||
return;
|
||||
}
|
||||
if(loginType === "call" && !seatNum){
|
||||
alert("자리번호를 입력해 주세요");
|
||||
return;
|
||||
}
|
||||
|
||||
setError(null);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
export const clientEnv = {
|
||||
ENV: process.env.NEXT_PUBLIC_ENV as string,
|
||||
API_BASE: process.env.NEXT_PUBLIC_API_BASE as string,
|
||||
STORE_KEY: process.env.NEXT_PUBLIC_STORE_KEY as string,
|
||||
// 다른 클라이언트 전용 env들 추가 가능
|
||||
const required = <K extends keyof typeof RAW_PUBLIC_ENV>(name: K) => {
|
||||
const v = RAW_PUBLIC_ENV[name];
|
||||
if (!v) throw new Error(`Missing env: ${name}`);
|
||||
return v;
|
||||
};
|
||||
if (!clientEnv.ENV) {
|
||||
throw new Error("Missing env: NEXT_PUBLIC_ENV");
|
||||
}
|
||||
|
||||
if (!clientEnv.API_BASE) {
|
||||
throw new Error("Missing env: NEXT_PUBLIC_API_BASE");
|
||||
}
|
||||
const RAW_PUBLIC_ENV = {
|
||||
NEXT_PUBLIC_ENV: process.env.NEXT_PUBLIC_ENV,
|
||||
NEXT_PUBLIC_API_BASE: process.env.NEXT_PUBLIC_API_BASE,
|
||||
NEXT_PUBLIC_STORE_KEY: process.env.NEXT_PUBLIC_STORE_KEY,
|
||||
} as const;
|
||||
|
||||
if (!clientEnv.STORE_KEY) {
|
||||
throw new Error("Missing env: NEXT_PUBLIC_STORE_KEY");
|
||||
}
|
||||
export const clientEnv = {
|
||||
ENV: required("NEXT_PUBLIC_ENV"),
|
||||
API_BASE: required("NEXT_PUBLIC_API_BASE"),
|
||||
STORE_KEY: required("NEXT_PUBLIC_STORE_KEY"),
|
||||
};
|
||||
Reference in New Issue
Block a user