Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import axios from 'axios';
  2. export class Api {
  3. constructor() {
  4. this.baseURL = require(__dirname + '/' + process.env.REACT_APP_NODE_ENV).default;
  5. this.axios = axios.create({
  6. baseURL: this.baseURL
  7. });
  8. }
  9.  
  10. getAPIS(url, config) {
  11. return this.axios.get(url, config);
  12. }
  13.  
  14. postAPIS(url, config) {
  15. return this.axios.post(url, config);
  16. }
  17.  
  18. postLogin(url, username, password) {
  19. const config = {};
  20. const data = {};
  21. data.username = username;
  22. data.password = password;
  23. config.data = data;
  24. return this.postAPIS(url, config);
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement