iachat/app/javascript
Sivin Varghese 787ac3134d
fix: TypeError cannot read properties of undefined (reading 'data') (#9766)
# Pull Request Template

## Description

**Issue**
The error `Cannot read properties of undefined (reading 'data')` occurs
because the `error.response.data` is accessed without checking if
`error.response` is present.

I can able to reproduce this issue.

**Solution**
To resolve this issue, I can add a check to ensure that this
`error.response` is defined before accessing the `error.response.data`

Fixes
https://linear.app/chatwoot/issue/CW-3406/typeerror-cannot-read-properties-of-undefined-reading-data

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
2024-07-12 09:21:40 +05:30
..
dashboard fix: TypeError cannot read properties of undefined (reading 'data') (#9766) 2024-07-12 09:21:40 +05:30
packs feat: Adds the ability to disable the "new message notification" popup (#9594) 2024-06-11 08:14:58 +05:30
portal feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722) 2024-07-10 08:32:16 -07:00
sdk fix: Avoid overflow caused by the empty span element (#9753) 2024-07-10 19:56:46 -07:00
shared feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722) 2024-07-10 08:32:16 -07:00
superadmin_pages refactor: handling keyboard shortcuts (#9242) 2024-04-26 15:41:02 +05:30
survey chore(i18n): Update the latest translations (#9340) 2024-05-02 08:18:17 -07:00
v3 feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722) 2024-07-10 08:32:16 -07:00
widget feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722) 2024-07-10 08:32:16 -07:00