Merge branch 'main' of https://gitea.o2o.kr/castad/o2o-castad-frontend
commit
8086e28908
|
|
@ -124,6 +124,17 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 붙여넣기 시 URL만 추출
|
||||||
|
const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {
|
||||||
|
if (searchType !== 'url') return;
|
||||||
|
const pasted = e.clipboardData.getData('text');
|
||||||
|
const urlMatch = pasted.match(/https?:\/\/[^\s]+/);
|
||||||
|
if (urlMatch) {
|
||||||
|
e.preventDefault();
|
||||||
|
setInputValue(urlMatch[0]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 폼 제출 처리
|
// 폼 제출 처리
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
@ -212,6 +223,7 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
onPaste={handlePaste}
|
||||||
onFocus={() => {
|
onFocus={() => {
|
||||||
if (searchType === 'name' && autocompleteResults.length > 0) {
|
if (searchType === 'name' && autocompleteResults.length > 0) {
|
||||||
setShowAutocomplete(true);
|
setShowAutocomplete(true);
|
||||||
|
|
|
||||||
|
|
@ -596,14 +596,28 @@ export async function refreshAccessToken(): Promise<TokenRefreshResponse> {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 로컬 스토리지 전체 정리
|
||||||
|
function clearAllLocalData() {
|
||||||
|
clearTokens();
|
||||||
|
localStorage.removeItem('castad_view_mode');
|
||||||
|
localStorage.removeItem('castad_analysis_data');
|
||||||
|
localStorage.removeItem('castad_wizard_step');
|
||||||
|
localStorage.removeItem('castad_active_item');
|
||||||
|
localStorage.removeItem('castad_song_task_id');
|
||||||
|
localStorage.removeItem('castad_image_task_id');
|
||||||
|
localStorage.removeItem('castad_song_generation');
|
||||||
|
localStorage.removeItem('castad_video_generation');
|
||||||
|
localStorage.removeItem('castad_video_ratio');
|
||||||
|
}
|
||||||
|
|
||||||
// 로그아웃
|
// 로그아웃
|
||||||
export async function logout(): Promise<void> {
|
export async function logout(): Promise<void> {
|
||||||
const response = await authenticatedFetch(`${API_URL}/user/auth/logout`, {
|
const response = await authenticatedFetch(`${API_URL}/user/auth/logout`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
});
|
});
|
||||||
|
|
||||||
// 응답과 관계없이 로컬 토큰 삭제
|
// 응답과 관계없이 로컬 데이터 전체 삭제
|
||||||
clearTokens();
|
clearAllLocalData();
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
|
@ -616,8 +630,8 @@ export async function logoutAll(): Promise<void> {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
});
|
});
|
||||||
|
|
||||||
// 응답과 관계없이 로컬 토큰 삭제
|
// 응답과 관계없이 로컬 데이터 전체 삭제
|
||||||
clearTokens();
|
clearAllLocalData();
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue