feat: added current user validation to apis
Signed-off-by: Varun Raj <mailme@varunraj.in>
This commit is contained in:
1 parent
12500c9c6e
commit
28d3deabcd
23 files changed
+586
-92
No files matched your search
@@ -3,58 +3,6 @@ import axios from 'axios'
|
||||
import qs from 'qs'
|
||||
|
||||
|
||||
// const handleErrors = (error: AxiosError | any) => {
|
||||
// console.error('error_message', error.message)
|
||||
// if (error.message === 'canceled') {
|
||||
// const cancelledError = {
|
||||
// code: 'ERR_CANCELED',
|
||||
// message: 'Request canceled',
|
||||
// }
|
||||
// return Promise.reject(cancelledError)
|
||||
// }
|
||||
// let errorObject = {}
|
||||
// if (error.response) {
|
||||
// const { status } = error.response
|
||||
// if (status === 401) {
|
||||
// errorObject = {
|
||||
// ...error.response.data,
|
||||
// message: error.response.data.message,
|
||||
// }
|
||||
// if (typeof window !== 'undefined' && window.location) {
|
||||
// // return resetSession().then(() => {
|
||||
// // window.location.href = '/auth/signin'
|
||||
// // return Promise.reject(errorObject)
|
||||
// // })
|
||||
// }
|
||||
// } else if (status === 403) {
|
||||
// errorObject = {
|
||||
// ...error.response.data,
|
||||
// message:
|
||||
// 'You do not have access to this page. Please contact your administrator!',
|
||||
// }
|
||||
// if (typeof window !== 'undefined' && window.location) {
|
||||
// // deleteLocalHashData()
|
||||
// window.location.href = '/404'
|
||||
// return Promise.reject(errorObject)
|
||||
// }
|
||||
// } else 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)
|
||||
// }
|
||||
// errorObject = {
|
||||
// message: 'Network Error. Please check your connection and try again!',
|
||||
// }
|
||||
// return Promise.reject(errorObject)
|
||||
// }
|
||||
|
||||
export default class API {
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user