Skip to content

Commit 1e556e0

Browse files
committed
fix: wait for api key creation
1 parent 657c178 commit 1e556e0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/DashboardApi.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,12 @@ export class DashboardApi {
155155
},
156156
);
157157

158-
const result = await CreateApiKeyResponse.parse(await response.json());
158+
const key = CreateApiKeyResponse.parse(await response.json()).data.attributes.value;
159159

160-
return result.data.attributes.value;
160+
const client = algoliasearch(applicationId, key);
161+
await client.waitForApiKey({ key, operation: "add" });
162+
163+
return key;
161164
}
162165

163166
async #makeRequest(url: string, requestInit: RequestInit = {}): Promise<Response> {

0 commit comments

Comments
 (0)