Skip to content

Commit 6501787

Browse files
committed
Update waitTask calls in playgrounds
1 parent 92cbd07 commit 6501787

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

playgrounds/autocomplete/setup.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ const client = new MeiliSearch({
66
apiKey: 'masterKey',
77
})
88
await client.index('steam-video-games').delete()
9-
const task = await client.index('steam-video-games').addDocuments(games)
10-
await client.waitForTask(task.taskUid)
9+
client.index('steam-video-games').addDocuments(games).waitTask()

playgrounds/local-react/setup.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ await gamesIndex.updateSettings({
2222
sortableAttributes: ['recommendationCount'],
2323
})
2424

25-
const moviesRes = await moviesIndex.addDocuments(movies)
26-
const gamesRes = await gamesIndex.addDocuments(games)
25+
const moviesTask = await moviesIndex.addDocuments(movies)
26+
const gamesTask = await gamesIndex.addDocuments(games)
27+
28+
await moviesTask.waitTask()
29+
await gamesTask.waitTask()
2730

28-
const moviesTask = await client.waitForTask(moviesRes.taskUid)
29-
const gamesTask = await client.waitForTask(gamesRes.taskUid)
3031
console.log(moviesTask)
3132
console.log(gamesTask)

playgrounds/node-env/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const msClient = new MeiliSearch({
1212
})
1313

1414
try {
15-
const task1 = await msClient.index('node_test').addDocuments([])
16-
await msClient.waitForTask(task1.taskUid)
15+
await msClient.index('node_test').addDocuments([]).waitTask()
1716
await searchClient.search([
1817
{
1918
indexName: 'node_test',
@@ -23,8 +22,7 @@ try {
2322
},
2423
])
2524

26-
const task2 = await msClient.index('node_test').delete()
27-
await msClient.waitForTask(task2.taskUid)
25+
await msClient.index('node_test').delete().waitTask()
2826
process.exit(0)
2927
} catch (e) {
3028
console.log(e)

0 commit comments

Comments
 (0)