add eslint / prettier
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-23 14:18:51 +01:00
parent 4d1d2e6ed8
commit 33d1425fbb
24 changed files with 1294 additions and 398 deletions

View File

@@ -30,7 +30,7 @@ export class ApiError extends Error {
code,
requestId,
details,
rawMessage
rawMessage,
}: {
message: string;
status: number;
@@ -59,7 +59,7 @@ function parseErrorPayload(data: unknown) {
code: undefined as string | undefined,
rawMessage: undefined as string | undefined,
requestId: undefined as string | undefined,
details: undefined as unknown
details: undefined as unknown,
};
}
@@ -88,7 +88,7 @@ export function createApiClient(config: CreateApiClientConfig) {
baseUrl,
resolveError = defaultResolveError,
inferErrorCodeFromStatus,
fetchImpl
fetchImpl,
} = config;
async function request<T>(path: string, options: RequestOptions = {}): Promise<T> {
@@ -99,9 +99,9 @@ export function createApiClient(config: CreateApiClientConfig) {
method,
headers: {
'Content-Type': 'application/json',
...(token ? { Authorization: `Bearer ${token}` } : {})
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
body: body ? JSON.stringify(body) : undefined
body: body ? JSON.stringify(body) : undefined,
});
const data = await response.json().catch(() => null);
@@ -112,7 +112,7 @@ export function createApiClient(config: CreateApiClientConfig) {
const message = resolveError({
code,
status: response.status,
fallbackMessage: parsed.rawMessage
fallbackMessage: parsed.rawMessage,
});
throw new ApiError({
@@ -121,7 +121,7 @@ export function createApiClient(config: CreateApiClientConfig) {
code,
requestId: parsed.requestId,
details: parsed.details,
rawMessage: parsed.rawMessage
rawMessage: parsed.rawMessage,
});
}
@@ -129,6 +129,6 @@ export function createApiClient(config: CreateApiClientConfig) {
}
return {
request
request,
};
}