Commit d58eba5
committed
Fix login failure and preserve server error messages
- api/v1/ping returns text/plain 'pong'; returning undefined for non-JSON
responses caused useAuthStore.setUser to always throw 'Authentication failed'.
Now return the text body when non-JSON.
- On non-2xx responses, read the body and attach it as err.response = { status, data }
so existing callers (e.g. Editor.vue) can surface the server-provided message
via err.response.data.message, matching the previous axios shape.1 parent e51ba46 commit d58eba5
1 file changed
Lines changed: 13 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
79 | 85 | | |
80 | 86 | | |
81 | | - | |
82 | | - | |
| 87 | + | |
83 | 88 | | |
84 | 89 | | |
85 | 90 | | |
0 commit comments