mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Update store key after api's apiBase change
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
8d74f1c759
commit
3c78e2fce9
@ -43,6 +43,14 @@ export class ApiManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateStoreKey(oldKey: string) {
|
||||||
|
const store = this.stores.get(oldKey);
|
||||||
|
|
||||||
|
if (!store) return;
|
||||||
|
this.stores.delete(oldKey);
|
||||||
|
this.registerStore(store, [store.api]);
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
registerStore(store: KubeObjectStore, apis: KubeApi[] = [store.api]) {
|
registerStore(store: KubeObjectStore, apis: KubeApi[] = [store.api]) {
|
||||||
apis.forEach(api => {
|
apis.forEach(api => {
|
||||||
|
|||||||
@ -229,8 +229,11 @@ export class KubeApi<T extends KubeObject = any> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (this.apiVersionPreferred) {
|
if (this.apiVersionPreferred) {
|
||||||
Object.defineProperty(this, "apiBase", { value: this.getUrl() });
|
const apiBase = this.getUrl();
|
||||||
|
|
||||||
|
Object.defineProperty(this, "apiBase", { value: apiBase });
|
||||||
apiManager.registerApi(this.apiBase, this);
|
apiManager.registerApi(this.apiBase, this);
|
||||||
|
apiManager.updateStoreKey(this.objectConstructor.apiBase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user