YouTube Analytics API 오류 처리추가
parent
5b6fab8ef4
commit
7c3c0b4508
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"recommendations": []
|
|
||||||
}
|
|
||||||
22
index.css
22
index.css
|
|
@ -2075,31 +2075,9 @@
|
||||||
height: 64px;
|
height: 64px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comp2-inquiry-btn {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
padding: 8px 16px;
|
|
||||||
background: transparent;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
||||||
border-radius: 8px;
|
|
||||||
color: rgba(255, 255, 255, 0.8);
|
|
||||||
font-size: 14px;
|
|
||||||
text-decoration: none;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 0.2s, border-color 0.2s, color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comp2-inquiry-btn:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.1);
|
|
||||||
border-color: rgba(255, 255, 255, 0.6);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comp2-back-btn {
|
.comp2-back-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
||||||
|
|
@ -331,17 +331,6 @@ const CompletionContent: React.FC<CompletionContentProps> = ({
|
||||||
</svg>
|
</svg>
|
||||||
<span>{t('completion.back')}</span>
|
<span>{t('completion.back')}</span>
|
||||||
</button>
|
</button>
|
||||||
<a
|
|
||||||
href="https://forms.gle/4a8mGebBYtdesvby9"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="comp2-inquiry-btn"
|
|
||||||
>
|
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
|
||||||
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
|
||||||
</svg>
|
|
||||||
<span>문의하기</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="comp2-title-row">
|
<div className="comp2-title-row">
|
||||||
|
|
|
||||||
|
|
@ -480,6 +480,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [error, setError] = useState<DashboardError | null>(null);
|
const [error, setError] = useState<DashboardError | null>(null);
|
||||||
const [showMockData, setShowMockData] = useState(false);
|
const [showMockData, setShowMockData] = useState(false);
|
||||||
|
const [retryTrigger, setRetryTrigger] = useState(0);
|
||||||
|
|
||||||
// 계정 관련 state
|
// 계정 관련 state
|
||||||
const [accounts, setAccounts] = useState<ConnectedAccount[]>([]);
|
const [accounts, setAccounts] = useState<ConnectedAccount[]>([]);
|
||||||
|
|
@ -576,7 +577,8 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
|
||||||
setDashboardData(null);
|
setDashboardData(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new Error(errorData.detail || `API Error: ${response.status}`);
|
setError({ code: errorData.code || 'API_ERROR', message: errorData.detail || `API Error: ${response.status}`, reconnect_url: errorData.reconnect_url });
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data: DashboardResponse = await response.json();
|
const data: DashboardResponse = await response.json();
|
||||||
|
|
@ -591,7 +593,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
|
||||||
setError(null);
|
setError(null);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Dashboard API Error:', err);
|
console.error('Dashboard API Error:', err);
|
||||||
setError(err instanceof Error ? err.message : 'Unknown error');
|
setError({ code: 'UNKNOWN', message: err instanceof Error ? err.message : 'Unknown error' });
|
||||||
setDashboardData(null);
|
setDashboardData(null);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
@ -599,7 +601,7 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchDashboardData();
|
fetchDashboardData();
|
||||||
}, [mode, selectedAccountId, accountsLoaded]);
|
}, [mode, selectedAccountId, accountsLoaded, retryTrigger]);
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
|
|
@ -688,6 +690,14 @@ const DashboardContent: React.FC<DashboardContentProps> = ({ onNavigate }) => {
|
||||||
연동하러 가기 →
|
연동하러 가기 →
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{(error.code === 'YOUTUBE_API_FAILED' || error.code === 'DASHBOARD_DATA_ERROR') && (
|
||||||
|
<button
|
||||||
|
onClick={() => { setError(null); setRetryTrigger((n: number) => n + 1); }}
|
||||||
|
className="ml-4 px-4 py-2 bg-yellow-600 text-white rounded hover:bg-yellow-700 whitespace-nowrap"
|
||||||
|
>
|
||||||
|
재시도 →
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue