refactor error handling in profile tab

This commit is contained in:
Shpuld Shpuldson 2020-12-02 12:46:31 +02:00
parent 397622078f
commit 4dde9c4d52
7 changed files with 41 additions and 76 deletions

View file

@ -162,7 +162,12 @@ const updateProfileImages = ({ credentials, avatar = null, banner = null, backgr
body: form
})
.then((data) => data.json())
.then((data) => parseUser(data))
.then((data) => {
if (data.error) {
throw new Error(data.error)
}
return parseUser(data)
})
}
const updateProfile = ({ credentials, params }) => {