feat: setup auth flow to work in parallel with api key
Signed-off-by: Varun Raj <mailme@varunraj.in>
This commit is contained in:
1 parent
2f19b5908d
commit
5e71e1eeeb
23 files changed
+296
-30
No files matched your search
+5
-13
@@ -7,23 +7,15 @@ const handleErrors = (error: AxiosError | any) => {
|
||||
if (error.code === "ERR_BAD_RESPONSE") {
|
||||
return Promise.reject({
|
||||
error: "Unable to process this request, please try again later",
|
||||
message: error.code
|
||||
message: error.code,
|
||||
});
|
||||
}
|
||||
let errorObject = {}
|
||||
if (error.response) {
|
||||
const { status } = error.response
|
||||
if (status === 422) {
|
||||
errorObject = {
|
||||
...error.response.data,
|
||||
message: 'Unable to process this request, please try again later',
|
||||
}
|
||||
} else {
|
||||
errorObject = {
|
||||
...error.response.data,
|
||||
}
|
||||
}
|
||||
return Promise.reject(errorObject)
|
||||
return Promise.reject({
|
||||
...error.response.data,
|
||||
status: error.response.status,
|
||||
})
|
||||
}
|
||||
errorObject = {
|
||||
message: 'Network Error. Please check your connection and try again!',
|
||||
|
||||
Reference in new issue
Block a user