Skip to content

Commit

Permalink
fix(client-ngx): Support Observables for config: runtime token change…
Browse files Browse the repository at this point in the history
… case
  • Loading branch information
paveltiunov committed Oct 8, 2019
1 parent 31a826d commit 0e30773
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/cubejs-client-ngx/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ export class CubejsClient {

private apiInstace() {
if(!this.cubeJsApi) {
this.cubeJsApi = cubejs(
this.config.token,
this.config.options
);
if (this.config instanceof Observable) {
this.config.subscribe((config) => {
this.cubeJsApi = cubejs(
config.token,
config.options
)
})
} else {
this.cubeJsApi = cubejs(
this.config.token,
this.config.options
);
}
}

return this.cubeJsApi;
Expand Down

0 comments on commit 0e30773

Please sign in to comment.