diff --git a/src/api.ts b/src/api.ts index 8961fb7ba..d97db087b 100644 --- a/src/api.ts +++ b/src/api.ts @@ -44,14 +44,14 @@ export class APIClient { } public request( - endpoint: E, params: P, credential?: string | null | undefined, + endpoint: E, params: P = {} as P, credential?: string | null | undefined, ): Promise> extends true ? Endpoints[E]['res']['$switch']['$default'] : StrictExtract[1] : Endpoints[E]['res']> { - const promise = new Promise((resolve, reject) => { + const promise = new Promise((resolve, reject) => { this.fetch(`${this.origin}/api/${endpoint}`, { method: 'POST', body: JSON.stringify({ @@ -76,6 +76,6 @@ export class APIClient { }).catch(reject); }); - return promise; + return promise as any; } }