createImage(token, data) { return http.post('/image', data, { headers: { Authorization: 'Bearer ' + token } }) }
const create = data => new Promise((resolve, reject) => { instance .post('/', data) .then(result => { const task = result.data; resolve(task); }) .catch(error => { reject(error); }); })
const create = async note => { const data = new FormData(); data.append('title', note.title); data.append('content', note.content); data.append('image', note.image); try { const response = await apiService.post(`/create`, data); return response.data.note; } catch (error) { throw error; } }
const getIssuesOfRepository = (path, cursor) => { const [organization, repository] = path.split('/') return axiosGitHubGraphQL.post('', { query: GET_ISSUES_OF_REPOSITORY, variables: {organization, repository, cursor}, }) }
const requestLogin = () => dispatch => { dispatch(login()); return axiosInstance .post('/auth') .then(response => dispatch(loginSuccess(response))) .catch(err => dispatch(loginFailure(err))); }
axios.post('/new-user', { email: this.state.email, password: this.state.password }) .then(response => { this.props.history.push('/'); this.props.setModal({ type: 'success', title: 'Success', text: 'New user registered' }); })
const fetchAllRecipes = () => (dispatch) => { dispatch(fetchAllRecipesStart()); return axios.post('/_find') .then((res) => normalize(res.data, schema.recipesListSchema)) .then((res) => dispatch(fetchAllRecipesSuccess(res))) .catch((err) => dispatch(fetchAllRecipesFail(err))); }
const postAndGetTransactions = formData => { const time = new Date().getTime(); if (formData.id) { } return api .post("", { ...formData, id: time, created: time }) .then(getTransactions); }
export function register(user){ return http.post(apiEndpoint,{ name:user.name, email:user.email, password:user.password }); }
axios.post('/delete-user', { id }) .then(() => { if (isOnlyElementOnPage && this.state.hasPrev) { this.onPrevHandler(); } else { this.loadData(); } });
const signUp = async data => { try { const response = await apiAuthenticationService.post(`/sign-up`, data); return response.data.user; } catch (error) { throw error; } }
const removeStarFromRepository = repositoryId => { return axiosGitHubGraphQL.post('', { query: REMOVE_STAR, variables: { repositoryId }, }); }
const signOut = async () => { try { await apiAuthenticationService.post(`/sign-out`); } catch (error) { throw error; } }
const signUp = async data => { try { const response = await apiAuthenticationService.post(`/sign-up`, data); return response.data.user; } catch (error) { throw error; } }
async function createNotification(product, action) { const notification = { notification: `O produto ${product} foi ${action}`, seen: false }; await api.post('api/notifications', notification); }