diff --git a/src/code-stats-api.ts b/src/code-stats-api.ts index 77ad3f6..927eae6 100644 --- a/src/code-stats-api.ts +++ b/src/code-stats-api.ts @@ -26,7 +26,7 @@ export class CodeStatsAPI { } - public sendUpdate(pulse: Pulse): void { + public sendUpdate(pulse: Pulse): axios.AxiosPromise { // If we did not have API key, don't try to update if (this.axios === null) { return null; @@ -44,7 +44,7 @@ export class CodeStatsAPI { let json: string = JSON.stringify(data); console.log(`JSON: ${json}`); - this.axios.post(this.UPDATE_URL, json) + return this.axios.post(this.UPDATE_URL, json) .then( (response) => { console.log(response); }) diff --git a/src/xp-counter.ts b/src/xp-counter.ts index cdd24ab..430758c 100644 --- a/src/xp-counter.ts +++ b/src/xp-counter.ts @@ -63,7 +63,13 @@ export class XpCounter { } this.updateTimeout = setTimeout(() => { - this.api.sendUpdate(this.pulse); + const promise = this.api.sendUpdate(this.pulse); + + if (promise !== null) { + promise.then(() => { + this.updateStatusBar(show, `${this.pulse.getXP(document.languageId)}`); + }); + } }, this.UPDATE_DELAY); }