서버오류 수정
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { setMarketNames } from '../utils/marketNameCache';
|
||||
import { UPBIT_API } from '../utils/upbitApi';
|
||||
|
||||
export type ChangeDir = 'RISE' | 'FALL' | 'EVEN';
|
||||
|
||||
@@ -69,7 +70,7 @@ function getMarketCode(raw: UpbitTickerRaw): string {
|
||||
}
|
||||
|
||||
async function fetchAllMarkets(): Promise<MarketInfo[]> {
|
||||
const res = await fetch('/upbit-api/v1/market/all?isDetails=true');
|
||||
const res = await fetch(`${UPBIT_API}/market/all?isDetails=true`);
|
||||
if (!res.ok) throw new Error(`market/all ${res.status}`);
|
||||
const data: UpbitMarketAll[] = await res.json();
|
||||
const krw = data.filter(m => m.market.startsWith('KRW-'));
|
||||
@@ -88,7 +89,7 @@ async function fetchAllTickers(markets: string[]): Promise<UpbitTickerRaw[]> {
|
||||
for (let i = 0; i < markets.length; i += 100) {
|
||||
const chunk = markets.slice(i, i + 100);
|
||||
try {
|
||||
const res = await fetch(`/upbit-api/v1/ticker?markets=${chunk.join(',')}`);
|
||||
const res = await fetch(`${UPBIT_API}/ticker?markets=${chunk.join(',')}`);
|
||||
if (res.ok) results.push(...(await res.json()));
|
||||
} catch { /* 부분 실패 무시 */ }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user