dashboard 형태의 UI 수정 및 고도화
This commit is contained in:
32
src/api.js
32
src/api.js
@@ -155,3 +155,35 @@ export async function getFearAndGreed() {
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
// VIX 지수 (Yahoo Finance 공개 API)
|
||||
export async function getVix() {
|
||||
const res = await fetch('/ext/vix', { headers: { Accept: 'application/json' } });
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
const data = await res.json();
|
||||
const price = data?.chart?.result?.[0]?.meta?.regularMarketPrice;
|
||||
if (price === undefined || price === null) throw new Error('VIX 데이터 없음');
|
||||
return { value: Math.round(price * 100) / 100 };
|
||||
}
|
||||
|
||||
// ── TODO API ─────────────────────────────────────────────────────────────────
|
||||
|
||||
export function getTodos() {
|
||||
return apiGet('/api/todos');
|
||||
}
|
||||
|
||||
export function addTodo(data) {
|
||||
return apiPost('/api/todos', data);
|
||||
}
|
||||
|
||||
export function updateTodo(id, data) {
|
||||
return apiPut(`/api/todos/${id}`, data);
|
||||
}
|
||||
|
||||
export function deleteTodo(id) {
|
||||
return apiDelete(`/api/todos/${id}`);
|
||||
}
|
||||
|
||||
export function clearTodos() {
|
||||
return apiDelete('/api/todos/done');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user