2
0

feat(input): ️ Better payment accessibility

This commit is contained in:
Baptiste Arnaud
2022-06-01 08:47:15 +02:00
parent 89d17a9ed3
commit c1461f0758
8 changed files with 78 additions and 31 deletions

View File

@ -44,8 +44,8 @@ export const sendRequest = async <ResponseData>(
? JSON.stringify(params.body)
: undefined,
})
if (!response.ok) throw new Error(response.statusText)
const data = await response.json()
if (!response.ok) throw 'error' in data ? data.error : data
return { data }
} catch (e) {
console.error(e)