fix
This commit is contained in:
parent
1736ee3837
commit
e7b171d648
|
@ -290,12 +290,6 @@ async function generateApiClientJSDoc(
|
||||||
'',
|
'',
|
||||||
' catch<TResult = never>(onrejected?: ((reason: TError) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TSuccess | TResult>;',
|
' catch<TResult = never>(onrejected?: ((reason: TError) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TSuccess | TResult>;',
|
||||||
'}',
|
'}',
|
||||||
'',
|
|
||||||
'class ErrPromise<TSuccess, TError> extends Promise<TSuccess> implements IErrPromise<TSuccess, TError> {',
|
|
||||||
' constructor(executor: (resolve: (value: TSuccess | PromiseLike<TSuccess>) => void, reject: (reason: TError) => void) => void) {',
|
|
||||||
' super(executor);',
|
|
||||||
' }',
|
|
||||||
'}',
|
|
||||||
);
|
);
|
||||||
endpointOutputLine.push('');
|
endpointOutputLine.push('');
|
||||||
|
|
||||||
|
@ -312,7 +306,7 @@ async function generateApiClientJSDoc(
|
||||||
' endpoint: E,',
|
' endpoint: E,',
|
||||||
' params: P,',
|
' params: P,',
|
||||||
' credential?: string | null,',
|
' credential?: string | null,',
|
||||||
' ): ErrPromise<SwitchCaseResponseType<E, P>, RE>;',
|
' ): IErrPromise<SwitchCaseResponseType<E, P>, RE>;',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (i < endpoints.length - 1) {
|
if (i < endpoints.length - 1) {
|
||||||
|
|
|
@ -65,8 +65,8 @@ export class APIClient {
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P = {} as P,
|
params: P = {} as P,
|
||||||
credential?: string | null,
|
credential?: string | null,
|
||||||
): ErrPromise<SwitchCaseResponseType<E, P>, RE> {
|
): IErrPromise<SwitchCaseResponseType<E, P>, RE> {
|
||||||
return new Promise((resolve, reject) => {
|
return new ErrPromise((resolve, reject) => {
|
||||||
this.fetch(`${this.origin}/api/${endpoint}`, {
|
this.fetch(`${this.origin}/api/${endpoint}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue