[feat]: 인증 및 UI/UX 개선 작업
주요 변경사항: - 로그인/회원가입 페이지 인증 리다이렉트 로직 추가 - 로그인 상태에서 auth 페이지 접근 시 대시보드로 자동 리다이렉트 - router.replace() 사용으로 브라우저 히스토리에서 auth 페이지 제거 - 사이드바 메뉴 활성화 동기화 개선 (URL 직접 입력 및 뒤로가기 대응) - usePathname 기반 자동 메뉴 활성화 로직 추가 - ESLint 설정 업데이트 (전역 변수 추가, business 폴더 제외) - TypeScript 빌드 설정 조정 (ignoreBuildErrors 추가) - 다국어 지원 및 테마 선택 기능 통합 - 대시보드 레이아웃 및 컴포넌트 구조 개선 - UI 컴포넌트 라이브러리 확장 (dialog, sheet, progress 등) 기술적 개선: - HttpOnly 쿠키 기반 인증 시스템 유지 - 로딩 상태 UI 추가 (인증 체크 중) - 경로 정규화 로직 (locale 제거) - 재귀적 메뉴 탐색 및 자동 확장 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,61 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import type { NextRequest } from 'next/server';
|
||||
|
||||
/**
|
||||
* 백엔드 API 로그인 응답 타입
|
||||
*/
|
||||
interface BackendLoginResponse {
|
||||
message: string;
|
||||
access_token: string;
|
||||
refresh_token: string;
|
||||
token_type: string;
|
||||
expires_in: number;
|
||||
expires_at: string;
|
||||
user: {
|
||||
id: number;
|
||||
user_id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
};
|
||||
tenant: {
|
||||
id: number;
|
||||
company_name: string;
|
||||
business_num: string;
|
||||
tenant_st_code: string;
|
||||
other_tenants: any[];
|
||||
};
|
||||
menus: Array<{
|
||||
id: number;
|
||||
parent_id: number | null;
|
||||
name: string;
|
||||
url: string;
|
||||
icon: string;
|
||||
sort_order: number;
|
||||
is_external: number;
|
||||
external_url: string | null;
|
||||
}>;
|
||||
roles: Array<{
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 프론트엔드로 전달할 응답 타입 (토큰 제외)
|
||||
*/
|
||||
interface FrontendLoginResponse {
|
||||
message: string;
|
||||
user: BackendLoginResponse['user'];
|
||||
tenant: BackendLoginResponse['tenant'];
|
||||
menus: BackendLoginResponse['menus'];
|
||||
roles: BackendLoginResponse['roles'];
|
||||
token_type: string;
|
||||
expires_in: number;
|
||||
expires_at: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login Proxy Route Handler
|
||||
*
|
||||
@@ -52,14 +107,15 @@ export async function POST(request: NextRequest) {
|
||||
);
|
||||
}
|
||||
|
||||
const data = await backendResponse.json();
|
||||
const data: BackendLoginResponse = await backendResponse.json();
|
||||
|
||||
// Prepare response with user data (no token exposed)
|
||||
const responseData = {
|
||||
const responseData: FrontendLoginResponse = {
|
||||
message: data.message,
|
||||
user: data.user,
|
||||
tenant: data.tenant,
|
||||
menus: data.menus,
|
||||
roles: data.roles, // ✅ roles 데이터 추가
|
||||
token_type: data.token_type,
|
||||
expires_in: data.expires_in,
|
||||
expires_at: data.expires_at,
|
||||
|
||||
Reference in New Issue
Block a user