1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix: checkPreferredVersion invalid if-condition

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2020-11-11 18:57:58 +02:00
parent b036fdc76b
commit 2db2bc78ae

View File

@ -109,17 +109,16 @@ export class KubeApi<T extends KubeObject = any> {
}
protected async checkPreferredVersion() {
if (!this.options.checkPreferredVersion || this.apiVersionPreferred === undefined) {
return;
}
const res = await this.request.get<IKubePreferredVersion>(`${this.apiPrefix}/${this.apiGroup}`);
Object.defineProperty(this, "apiVersionPreferred", {
value: res?.preferredVersion?.version ?? null,
});
if (this.options.checkPreferredVersion && this.apiVersionPreferred === undefined) {
const res = await this.request.get<IKubePreferredVersion>(`${this.apiPrefix}/${this.apiGroup}`);
Object.defineProperty(this, "apiVersionPreferred", {
value: res?.preferredVersion?.version ?? null,
});
if (this.apiVersionPreferred) {
Object.defineProperty(this, "apiBase", { value: this.getUrl() })
apiManager.registerApi(this.apiBase, this);
if (this.apiVersionPreferred) {
Object.defineProperty(this, "apiBase", { value: this.getUrl() })
apiManager.registerApi(this.apiBase, this);
}
}
}