chore: test deploy snapshot

This commit is contained in:
2026-05-28 22:47:45 +09:00
parent 753fd423db
commit 1e7212b862
6 changed files with 348 additions and 52 deletions

View File

@@ -1626,6 +1626,7 @@ async function requestChatApi<T>(
init?: RequestInit,
options?: {
allowUnauthenticated?: boolean;
signal?: AbortSignal;
timeoutMs?: number;
sharePin?: string | null;
},
@@ -1635,9 +1636,18 @@ async function requestChatApi<T>(
const accessToken = getRegisteredAccessToken();
const method = init?.method?.toUpperCase() ?? 'GET';
const controller = new AbortController();
const externalAbortHandler = () => controller.abort();
const timeoutMs = Number.isFinite(options?.timeoutMs) ? Math.max(1000, Number(options?.timeoutMs)) : 8000;
const timeoutId = window.setTimeout(() => controller.abort(), timeoutMs);
if (options?.signal) {
if (options.signal.aborted) {
window.clearTimeout(timeoutId);
throw new DOMException('Aborted', 'AbortError');
}
options.signal.addEventListener('abort', externalAbortHandler, { once: true });
}
if (!allowUnauthenticated && !hasRegisteredAccessTokenAccess()) {
window.clearTimeout(timeoutId);
throw new Error('등록된 접근 토큰이 없어 채팅 요청을 보낼 수 없습니다.');
@@ -1681,8 +1691,14 @@ async function requestChatApi<T>(
});
} catch (error) {
window.clearTimeout(timeoutId);
if (options?.signal) {
options.signal.removeEventListener('abort', externalAbortHandler);
}
if (error instanceof DOMException && error.name === 'AbortError') {
if (options?.signal?.aborted) {
throw error;
}
throw new Error('채팅 서버 응답이 지연됩니다.');
}
@@ -1690,6 +1706,9 @@ async function requestChatApi<T>(
}
window.clearTimeout(timeoutId);
if (options?.signal) {
options.signal.removeEventListener('abort', externalAbortHandler);
}
if (!response.ok) {
const contentType = response.headers.get('content-type')?.toLowerCase() ?? '';
@@ -2847,6 +2866,7 @@ export async function fetchChatShareSnapshot(
options?: {
sharePin?: string | null;
sessionId?: string | null;
signal?: AbortSignal;
view?: 'full' | 'initial';
},
) {
@@ -2882,6 +2902,7 @@ export async function fetchChatShareSnapshot(
undefined,
{
allowUnauthenticated: true,
signal: options?.signal,
sharePin: options?.sharePin,
timeoutMs: 20000,
},