260702_01_ENH: 리스트 작업 도중 공용 ui를 적용하기 위한 중간 커밋

This commit is contained in:
2026-07-02 17:02:17 +09:00
parent 6944064377
commit a8ce35f5bf
111 changed files with 2833 additions and 2557 deletions

View File

@@ -1,23 +1,27 @@
"use client";
"use client";
import Image from "next/image";
import {Button} from "@/components/ui/button";
import {Card, CardContent, CardHeader} from "@/components/ui/card";
import {Input} from "@/components/ui/input";
import React, {useEffect, useRef, useState} from "react";
import React, { Suspense, useEffect, useRef, useState } from "react";
import {useRouter, useSearchParams} from "next/navigation";
import { useStorage } from "@/hooks/useStorage"
import { StorageKeys } from "@/store/storage/storage-keys";
import {apiError} from "@/lib/http-util";
import {NONE_HTTP_ERROR} from "@/const/commonConst";
import {apiError} from "@kri/common/http";
import {NONE_HTTP_ERROR} from "@kri/common/http";
import {useLoginMutation} from "@/query/auth";
import {useInternalInfoQuery} from "@/query/internal";
const LoginPage = () => {
const LoginPageContent = () => {
const router = useRouter();
const searchParams = useSearchParams();
const typeParam = searchParams.get("type") ?? "";
const loginMutation = useLoginMutation();
const internalInfoQuery = useInternalInfoQuery();
// TODO: 받은 데이터 확인
console.log(internalInfoQuery.data);
const { get: getSeatNumberStorage } = useStorage(StorageKeys.SeatNumber);
@@ -32,15 +36,17 @@ const LoginPage = () => {
const seatNumberInputRef = useRef<HTMLInputElement | null>(null);
const tryLogin = async () => {
if (!userId) return alert("아이디를 입력해 주세요");
if (!userPw) return alert("PW를 입력해 주세요");
if (loginType === "call" && !seatNum) return alert("자리번호를 입력해 주세요");
if (!userId) return alert("Please enter ID.");
if (!userPw) return alert("Please enter password.");
if (loginType === "call" && !seatNum) return alert("Please enter seat number.");
setError(null);
try {
await loginMutation.mutateAsync({ userId, userPw, seatNum, loginType });
} catch (e) {
const err = apiError(e);
const err = apiError(e, {
fallbackMessage: "Login failed.",
});
if (err.status === 401 || err.status === 403) setError("아이디 또는 비밀번호를 다시 확인해주세요.");
else if (err.code === NONE_HTTP_ERROR) setError("알 수 없는 오류가 발생했습니다. 잠시 후 다시 시도해주세요.");
else setError(`로그인에 실패했습니다. (${err.message})`);
@@ -101,7 +107,7 @@ const LoginPage = () => {
<Image
src="/kri_logo.png" // public/kri_logo.png
alt="KRI 로고"
width={500} // 원하는 크기로 줄이기
width={500}
height={500}
className="object-contain ml-10"
priority
@@ -118,7 +124,7 @@ const LoginPage = () => {
name="id"
type="text"
required
placeholder="아이디를 입력하세요"
placeholder="Enter ID"
value={userId}
onChange={(e) => setUserId(e.currentTarget.value)}
onKeyDown={handleIdKeyDown}
@@ -133,7 +139,7 @@ const LoginPage = () => {
type="password"
autoComplete="current-password"
required
placeholder="PW를 입력하세요"
placeholder="Enter password"
value={userPw}
onChange={(e) => setUserPw(e.currentTarget.value)}
onKeyDown={handlePwKeyDown}
@@ -148,7 +154,7 @@ const LoginPage = () => {
id="seatNum"
name="seatNum"
type="text"
placeholder="자리번호를 입력하세요"
placeholder="Enter seat number"
value={seatNum}
onChange={(e) => setSeatNum(e.currentTarget.value)}
onKeyDown={handleSeatNumberKeyDown}
@@ -183,4 +189,10 @@ const LoginPage = () => {
);
}
const LoginPage = () => (
<Suspense fallback={null}>
<LoginPageContent />
</Suspense>
);
export default LoginPage;