가상매매 시간봉 제거
This commit is contained in:
@@ -10,12 +10,34 @@ import { storageGetSync, storageSetSync } from '../storage/index.js';
|
||||
/** Flow layout stored with strategy (matches frontend StrategyFlowLayoutStore). */
|
||||
export type StrategyFlowLayoutStore = Record<string, unknown>;
|
||||
|
||||
function resolveApiBase(): string {
|
||||
const fromEnv = typeof import.meta !== 'undefined'
|
||||
? (import.meta as ImportMeta & { env?: Record<string, string> }).env?.VITE_API_BASE_URL
|
||||
/** 배포 APK·exdev 기본 (HTTPS 443 미개방 — 반드시 http) */
|
||||
export const PRODUCTION_API_BASE = 'http://exdev.co.kr/api';
|
||||
|
||||
function viteEnv(): Record<string, string> | undefined {
|
||||
return typeof import.meta !== 'undefined'
|
||||
? (import.meta as ImportMeta & { env?: Record<string, string> }).env
|
||||
: undefined;
|
||||
const fromStorage = storageGetSync('gc_api_base_url');
|
||||
return fromStorage || fromEnv || 'http://localhost:8080/api';
|
||||
}
|
||||
|
||||
/** 저장된 API URL 정규화 — https exdev·localhost 제거 */
|
||||
export function normalizeApiBaseUrl(url: string | null | undefined): string | null {
|
||||
if (!url?.trim()) return null;
|
||||
let u = url.trim().replace(/\/$/, '');
|
||||
if (/localhost|127\.0\.0\.1/i.test(u)) return null;
|
||||
if (/^https:\/\/exdev\.co\.kr/i.test(u)) {
|
||||
u = u.replace(/^https:/i, 'http:');
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
function resolveApiBase(): string {
|
||||
const env = viteEnv();
|
||||
const fromStorage = normalizeApiBaseUrl(storageGetSync('gc_api_base_url'));
|
||||
const fromEnv = normalizeApiBaseUrl(env?.VITE_API_BASE_URL);
|
||||
if (fromStorage) return fromStorage;
|
||||
if (fromEnv) return fromEnv;
|
||||
if (env?.PROD) return PRODUCTION_API_BASE;
|
||||
return 'http://localhost:8080/api';
|
||||
}
|
||||
|
||||
/** 백엔드 REST base */
|
||||
@@ -82,8 +104,9 @@ function authHeaders(): Record<string, string> {
|
||||
return headers;
|
||||
}
|
||||
|
||||
const DEFAULT_FETCH_TIMEOUT_MS = 30_000;
|
||||
const LOGIN_FETCH_TIMEOUT_MS = 60_000;
|
||||
const DEFAULT_FETCH_TIMEOUT_MS = 45_000;
|
||||
/** exdev 첫 로그인 응답이 60초 이상 걸리는 경우 있음 */
|
||||
const LOGIN_FETCH_TIMEOUT_MS = 180_000;
|
||||
|
||||
function wrapNetworkError(e: unknown): Error {
|
||||
if (e instanceof TypeError || (e instanceof Error && /failed to fetch/i.test(e.message))) {
|
||||
|
||||
Reference in New Issue
Block a user