This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = Object.freeze({ | |
ACTION_UNAUTHORIZED: 'The user is unauthorized', | |
ACTION_NOT_FOUND: 'Resource Not Found', | |
ACTION_INTERNAL_SERVER: 'Internal Server Error', | |
ACTION_BAD_GATEWAY: 'Bad Gateway', | |
ACTION_SERVICE_UNAVAILABLE: 'The service is unavailable', | |
ACTION_REQUEST_TIMED_OUT: 'Request Timed Out', | |
ACTION_TOO_MANY: 'Too Many Requests', | |
ACTION_INSUFFICIENT_STORAGE: 'Insuffucient Storage', | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
import { toast } from 'react-toastify'; | |
import ConstantsList from './constants'; | |
class API { | |
constructor() { | |
let service = axios.create({}); | |
service.interceptors.response.use(this.handleSuccessResponse, this.handleErrorResponse); | |
this.service = service; | |
} |