Skip to content

Commit

Permalink
return nothing from waitForTask
Browse files Browse the repository at this point in the history
  • Loading branch information
eunjae-lee committed May 19, 2022
1 parent 98ce6be commit 395dfe6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions templates/javascript/api-single.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,13 @@ export function create{{capitalizedApiName}}(options: CreateClientOptions{{#hasR
}: {
indexName: string;
taskID: number;
} & Omit<CreateRetryablePromiseOptions, 'func' | 'validate'>): Promise<GetTaskResponse> {
return createRetryablePromise<GetTaskResponse>({
func: () => this.getTask({ indexName, taskID }),
validate: (response) => response.status === 'published',
...createRetryablePromiseOptions,
} & Omit<CreateRetryablePromiseOptions<GetTaskResponse>, 'func' | 'validate'>): Promise<void> {
return new Promise<void>((resolve, reject) => {
createRetryablePromise<GetTaskResponse>({
...createRetryablePromiseOptions,
func: () => this.getTask({ indexName, taskID }),
validate: (response) => response.status === 'published',
}).then(() => resolve()).catch(reject);
});
},
{{/isSearchClient}}
Expand Down

0 comments on commit 395dfe6

Please sign in to comment.