There's a method in my code that retrieves a token from an API:
let { Token } = await API.getToken({
postId: postId
})
if(){}
Whenever the token is null, I receive a warning in the console saying "Cannot read property 'Token' of null" because the API response itself is null. My objective is to execute a specific logic if this warning appears and the token is null. I attempted to use if(token==null)
, but it didn't work as expected. Is there another way to accomplish this?