We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5a31301 + 413b6fe commit 008afd6Copy full SHA for 008afd6
src/service/AvatarService.js
@@ -17,22 +17,18 @@ export const fetchAvatarUrl = (email) => {
17
})
18
19
return Axios.get(url, { adapter: 'fetch', fetchOptions: { priority: 'low' } })
20
- .then((resp) => resp.data)
21
- .then((avatar) => {
22
- if (avatar.isExternal) {
+ .then(res => {
+ if (res.status === 204) {
+ return undefined
23
+ }
24
+
25
+ if (res.data.isExternal) {
26
return generateUrl('/apps/mail/api/avatars/image/{email}', {
27
email,
28
- } else {
- return avatar.url
- }
29
- })
30
- .catch((err) => {
31
- if (err.response.status === 404) {
32
- return undefined
33
}
34
35
- return Promise.reject(err)
+ return res.data.url
36
37
38
0 commit comments