chore(root): migrate to biome
This commit is contained in:
@@ -44,7 +44,7 @@ export class Api {
|
||||
url: string,
|
||||
data: ReqBody,
|
||||
options: FetchOptions,
|
||||
attempt: number
|
||||
attempt: number,
|
||||
): Promise<ResBody | null> {
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
@@ -65,7 +65,7 @@ export class Api {
|
||||
return responseText ? JSON.parse(responseText) : null;
|
||||
} catch (error) {
|
||||
if (attempt < this.maxRetries) {
|
||||
const delay = this.initialRetryDelay * Math.pow(2, attempt);
|
||||
const delay = this.initialRetryDelay * 2 ** attempt;
|
||||
await new Promise((resolve) => setTimeout(resolve, delay));
|
||||
return this.post<ReqBody, ResBody>(url, data, options, attempt + 1);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ export class Api {
|
||||
async fetch<ReqBody, ResBody>(
|
||||
path: string,
|
||||
data: ReqBody,
|
||||
options: FetchOptions = {}
|
||||
options: FetchOptions = {},
|
||||
): Promise<ResBody | null> {
|
||||
const url = `${this.baseUrl}${path}`;
|
||||
return this.post<ReqBody, ResBody>(url, data, options, 0);
|
||||
|
||||
Reference in New Issue
Block a user