차트 수정
This commit is contained in:
@@ -4,6 +4,10 @@ import type { KisCredentialInput } from "@/lib/kis/config";
|
||||
import { hasKisConfig, normalizeTradingEnv } from "@/lib/kis/config";
|
||||
import { getDomesticOverview } from "@/lib/kis/domestic";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import {
|
||||
DOMESTIC_KIS_SESSION_OVERRIDE_HEADER,
|
||||
parseDomesticKisSession,
|
||||
} from "@/lib/kis/domestic-market-session";
|
||||
|
||||
/**
|
||||
* @file app/api/kis/domestic/overview/route.ts
|
||||
@@ -38,7 +42,13 @@ export async function GET(request: NextRequest) {
|
||||
const fallbackMeta = KOREAN_STOCK_INDEX.find((item) => item.symbol === symbol);
|
||||
|
||||
try {
|
||||
const overview = await getDomesticOverview(symbol, fallbackMeta, credentials);
|
||||
const sessionOverride = readSessionOverrideFromHeaders(request.headers);
|
||||
const overview = await getDomesticOverview(
|
||||
symbol,
|
||||
fallbackMeta,
|
||||
credentials,
|
||||
{ sessionOverride },
|
||||
);
|
||||
|
||||
const response: DashboardStockOverviewResponse = {
|
||||
stock: overview.stock,
|
||||
@@ -76,3 +86,9 @@ function readKisCredentialsFromHeaders(headers: Headers): KisCredentialInput {
|
||||
tradingEnv,
|
||||
};
|
||||
}
|
||||
|
||||
function readSessionOverrideFromHeaders(headers: Headers) {
|
||||
if (process.env.NODE_ENV === "production") return null;
|
||||
const raw = headers.get(DOMESTIC_KIS_SESSION_OVERRIDE_HEADER);
|
||||
return parseDomesticKisSession(raw);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user