Param20h kishalll commited on
Commit
18d827e
·
unverified ·
1 Parent(s): d22e308

fix(ui): remove duplicate patch method implementation in api.ts

Browse files

Fixes the TypeScript compilation error TS2393 by removing a duplicate definition of the patch method in ApiClient class in api.ts.

Co-authored-by: Kishal <kishal2007@gmail.com>

Files changed (1) hide show
  1. frontend/src/lib/api.ts +0 -20
frontend/src/lib/api.ts CHANGED
@@ -285,27 +285,7 @@ class ApiClient {
285
  return res.json();
286
  }
287
 
288
- async patch<T>(path: string, body?: unknown, options?: FetchOptions): Promise<T> {
289
- const res = await this.fetchWithConnectionError(`${this.baseUrl}${path}`, {
290
- method: "PATCH",
291
- headers: this.getHeaders(options?.token),
292
- body: body ? JSON.stringify(body) : undefined,
293
- ...options,
294
- });
295
-
296
- if (res.status === 401 && !options?._skipRefresh) {
297
- const newToken = await this.tryRefreshToken();
298
- if (newToken) {
299
- return this.patch<T>(path, body, { ...options, token: newToken, _skipRefresh: true });
300
- }
301
- }
302
-
303
- if (!res.ok) {
304
- throw new Error(await this.getErrorMessage(res, res.statusText || "Request failed"));
305
- }
306
 
307
- return res.json();
308
- }
309
 
310
  async delete<T>(path: string, options?: FetchOptions): Promise<T> {
311
  const res = await this.fetchWithConnectionError(`${this.baseUrl}${path}`, {
 
285
  return res.json();
286
  }
287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
 
 
 
289
 
290
  async delete<T>(path: string, options?: FetchOptions): Promise<T> {
291
  const res = await this.fetchWithConnectionError(`${this.baseUrl}${path}`, {