Commit c2fdb98
committed
fix: handle network errors during login to prevent TypeError crash
The login method in EmbeddedChatApi.ts returned undefined when a
non-401 error occurred (e.g. network failure). This caused a
TypeError in useRCAuth.js when accessing res.error on the undefined
response, crashing the login flow silently.
Changes:
- EmbeddedChatApi.ts: return an error object for all caught errors
instead of implicitly returning undefined
- useRCAuth.js: add a null guard on the login response as a safety
net, showing a toast message if the response is missing
Fixes #12101 parent e1a4d84 commit c2fdb98
2 files changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
0 commit comments