Commit 2a7b69cd authored by Nastassia Danilova's avatar Nastassia Danilova

process invalid JSONs in responce

parent 291456d5
Pipeline #29071 passed with stages
in 7 minutes and 8 seconds
......@@ -68,8 +68,7 @@ const resetPassword = async ({ config, queries }) => {
return utils.request({
method: 'POST',
config,
url: `/auth/password?${queryParams(queries)}`,
body: '{}'
url: `/auth/password?${queryParams(queries)}`
})
}
......
......@@ -42,16 +42,23 @@ const request = async ({ method = 'GET', url, params, queries, config, fullUrl =
body
})
let parsedResult = null
try {
parsedResult = await result.json()
} catch (e) {
parsedResult = result
}
if (result.ok) {
return {
state: 'ok',
data: await result.json(),
data: parsedResult,
links: parseLinkHeader(result.headers.get('link'))
}
} else {
return {
state: 'error',
data: await result.json()
data: parsedResult
}
}
} catch (e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment