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:
parent
2b2499107f
commit
26438715f6
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user