Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import axios from 'axios';
- export class Api {
- constructor() {
- this.baseURL = require(__dirname + '/' + process.env.REACT_APP_NODE_ENV).default;
- this.axios = axios.create({
- baseURL: this.baseURL
- });
- }
- getAPIS(url, config) {
- return this.axios.get(url, config);
- }
- postAPIS(url, config) {
- return this.axios.post(url, config);
- }
- postLogin(url, username, password) {
- const config = {};
- const data = {};
- data.username = username;
- data.password = password;
- config.data = data;
- return this.postAPIS(url, config);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement