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

Use optional chaining operator (?.) to avoid TypeError: Cannot read property 'replicas' of undefined

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
Signed-off-by: Hung-Han (Henry) Chen <1474479+chenhunghan@users.noreply.github.com>
This commit is contained in:
Hung-Han (Henry) Chen 2020-11-02 10:50:30 +08:00 committed by Hung-Han (Henry) Chen
parent 2b2499107f
commit 26438715f6
No known key found for this signature in database
GPG Key ID: 32931168425E1C95

View File

@ -10,7 +10,7 @@ export class DeploymentApi extends KubeApi<Deployment> {
getReplicas(params: { namespace: string; name: string }): Promise<number> {
return this.request
.get(this.getScaleApiUrl(params))
.then(({ status }: any) => status.replicas)
.then(({ status }: any) => status?.replicas)
}
scale(params: { namespace: string; name: string }, replicas: number) {