style(format): appliquer Prettier sur 6 fichiers du scaffold Sprint 0
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7fed47dfeb
commit
720d4dbbf8
6 changed files with 11 additions and 36 deletions
|
|
@ -1,10 +1,5 @@
|
|||
import { env } from '@/shared/config/env'
|
||||
import type {
|
||||
ApiError,
|
||||
ClientError,
|
||||
FetchError,
|
||||
FrontendErrorCode,
|
||||
} from '@/shared/types/api'
|
||||
import type { ApiError, ClientError, FetchError, FrontendErrorCode } from '@/shared/types/api'
|
||||
import { getAccessToken } from './auth-client'
|
||||
import { logger } from './logger'
|
||||
|
||||
|
|
@ -21,10 +16,7 @@ export interface ApiFetchOptions {
|
|||
retry?: { max: number; baseDelayMs: number }
|
||||
}
|
||||
|
||||
export async function apiFetch<T>(
|
||||
path: string,
|
||||
options: ApiFetchOptions = {},
|
||||
): Promise<T> {
|
||||
export async function apiFetch<T>(path: string, options: ApiFetchOptions = {}): Promise<T> {
|
||||
const method = (options.method ?? 'GET').toUpperCase()
|
||||
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS
|
||||
const retry =
|
||||
|
|
@ -144,12 +136,7 @@ function isFetchError(err: unknown): err is FetchError {
|
|||
async function parseApiError(response: Response): Promise<ApiError> {
|
||||
try {
|
||||
const body = await response.json()
|
||||
if (
|
||||
body &&
|
||||
typeof body === 'object' &&
|
||||
body.error === true &&
|
||||
typeof body.code === 'string'
|
||||
) {
|
||||
if (body && typeof body === 'object' && body.error === true && typeof body.code === 'string') {
|
||||
return body as ApiError
|
||||
}
|
||||
} catch {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue