Last active
December 4, 2019 15:02
-
-
Save victorcbr/db4c8bef65c566165a2f33c7c5cdf6da to your computer and use it in GitHub Desktop.
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'; | |
const isDev = process.env.NODE_ENV === 'development'; | |
let baseURL = isDev ? | |
'http://teste.clickpygg.com/api/' | |
: | |
'http://dashboard.clickpygg.com/api/'; | |
const api = axios.create({ | |
baseURL: baseURL, | |
headers: { | |
"Content-Type": "application/json", | |
}, | |
}); | |
// | |
// Auth | |
// | |
export const makeLogin = (data) => api.post(`usuarios/login.json`, data, | |
{ | |
auth: { | |
username: data.email, | |
password: data.senha | |
} | |
}).then(({data}) => {return data}); | |
// | |
// Usuários | |
// | |
export const getUser = (customerId) => api.get(`customers/${customerId}`).then(({data}) => {return data}); | |
export const createUser = (data) => api.post(`customers`, data); | |
export const updateUser = (customerId, data) => api.put(`customers/${customerId}`, data); | |
export const deleteUser = (customerId) => api.delete(`customers/${customerId}`); | |
export default api; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment