chore: prettier everywhere

This commit is contained in:
Julien Froidefond
2025-10-09 13:40:03 +02:00
parent f8100ae3e9
commit d9cf9a2655
303 changed files with 15420 additions and 9391 deletions

View File

@@ -13,7 +13,7 @@ export class HttpClient {
options: RequestInit = {}
): Promise<T> {
const url = `${this.baseUrl}${endpoint}`;
const config: RequestInit = {
headers: {
'Content-Type': 'application/json',
@@ -24,10 +24,12 @@ export class HttpClient {
try {
const response = await fetch(url, config);
if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
throw new Error(errorData.error || `HTTP ${response.status}: ${response.statusText}`);
throw new Error(
errorData.error || `HTTP ${response.status}: ${response.statusText}`
);
}
return await response.json();
@@ -38,10 +40,10 @@ export class HttpClient {
}
async get<T>(endpoint: string, params?: Record<string, string>): Promise<T> {
const url = params
const url = params
? `${endpoint}?${new URLSearchParams(params)}`
: endpoint;
return this.request<T>(url, { method: 'GET' });
}
@@ -66,11 +68,14 @@ export class HttpClient {
});
}
async delete<T>(endpoint: string, params?: Record<string, string>): Promise<T> {
const url = params
async delete<T>(
endpoint: string,
params?: Record<string, string>
): Promise<T> {
const url = params
? `${endpoint}?${new URLSearchParams(params)}`
: endpoint;
return this.request<T>(url, { method: 'DELETE' });
}
}