Skip to content

Commit 0e30773

Browse files
committed
fix(client-ngx): Support Observables for config: runtime token change case
1 parent 31a826d commit 0e30773

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

packages/cubejs-client-ngx/src/client.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,19 @@ export class CubejsClient {
1313

1414
private apiInstace() {
1515
if(!this.cubeJsApi) {
16-
this.cubeJsApi = cubejs(
17-
this.config.token,
18-
this.config.options
19-
);
16+
if (this.config instanceof Observable) {
17+
this.config.subscribe((config) => {
18+
this.cubeJsApi = cubejs(
19+
config.token,
20+
config.options
21+
)
22+
})
23+
} else {
24+
this.cubeJsApi = cubejs(
25+
this.config.token,
26+
this.config.options
27+
);
28+
}
2029
}
2130

2231
return this.cubeJsApi;

0 commit comments

Comments
 (0)