자동완성 기능 추가 .

This commit is contained in:
HyeongBaeYang committed 2026-01-29 16:06:35 +09:00
1 parent 7ee911f0aa
commit 6d89a28982
5 files changed
+84 -56

No files matched your search

+11 -24
View File
@@ -446,7 +446,6 @@ export function clearTokens() {
// 인증 헤더 생성
function getAuthHeader(): HeadersInit {
const token = getAccessToken();
console.log('[Auth] Token exists:', !!token, token ? `${token.substring(0, 20)}...` : 'null');
return token ? { 'Authorization': `Bearer ${token}` } : {};
}
@@ -489,14 +488,10 @@ export async function kakaoCallback(code: string): Promise<KakaoCallbackResponse
}
const data: KakaoCallbackResponse = await verifyResponse.json();
console.log('[Auth] Kakao verify response:', {
hasAccessToken: !!data.access_token,
hasRefreshToken: !!data.refresh_token
});
// 토큰 저장
saveTokens(data.access_token, data.refresh_token);
console.log('[Auth] Tokens saved to localStorage');
return data;
}
@@ -592,27 +587,19 @@ export function isLoggedIn(): boolean {
}
// ============================================
// 네이버 지역 검색 & 자동완성 API
// 숙소 검색 & 자동완성 API
// ============================================
export interface NaverLocalSearchItem {
title: string;
link: string;
category: string;
description: string;
telephone: string;
export interface AccommodationSearchItem {
address: string;
roadAddress: string;
mapx: string;
mapy: string;
title: string;
}
export interface NaverLocalSearchResponse {
lastBuildDate: string;
total: number;
start: number;
display: number;
items: NaverLocalSearchItem[];
export interface AccommodationSearchResponse {
count: number;
items: AccommodationSearchItem[];
query: string;
}
export interface AutocompleteRequest {
@@ -621,9 +608,9 @@ export interface AutocompleteRequest {
title: string;
}
// 네이버 지역 검색 API (백엔드 프록시 경유)
export async function searchNaverLocal(query: string): Promise<NaverLocalSearchResponse> {
const response = await fetch(`${API_URL}/naver/local/search?query=${encodeURIComponent(query)}`, {
// 숙소 검색 API (업체명 자동완성용)
export async function searchAccommodation(query: string): Promise<AccommodationSearchResponse> {
const response = await fetch(`${API_URL}/search/accommodation?query=${encodeURIComponent(query)}`, {
method: 'GET',
headers: {
...getAuthHeader(),