Skip to content

Commit

Permalink
fix(demos) use token also for job polling
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Sep 13, 2024
1 parent f3740ad commit 2d2753c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion demos/js-client/skynet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,17 @@ export class SkynetClient {
const d = createDeferred();

// Poll for it.
const pHeaders = {};

if (this._token) {
pHeaders['Authorization'] = `Bearer ${this._token}`;
}

const int = setInterval(async () => {
try {
const r = await fetch(`${this._baseUrl}/summaries/v1/job/${jobId}`);
const r = await fetch(`${this._baseUrl}/summaries/v1/job/${jobId}`, {
headers: pHeaders
});
const data = await r.json();

if (data.status === 'success') {
Expand Down

0 comments on commit 2d2753c

Please sign in to comment.