Commit 0f786295 authored by Christopher Cottier's avatar Christopher Cottier

all api routes based on baseApiUrl in config

parent 0ec403fd
import axios from 'axios'; import axios from 'axios';
import Config from '../config';
export const fetchUserCart = userEmail => { export const fetchUserCart = userEmail => {
return axios.get(`http://localhost:8080/api/carts/${userEmail}`) return axios.get(`${Config.baseApiUrl}/api/carts/${userEmail}`)
} }
export const createCart = newCart => { export const createCart = newCart => {
return axios.post(`http://localhost:8080/api/carts`, newCart) return axios.post(`${Config.baseApiUrl}/api/carts`, newCart)
} }
export const updateCart = (updatedCart, userEmail) => { export const updateCart = (updatedCart, userEmail) => {
return axios.put(`http://localhost:8080/api/carts/${userEmail}`, updatedCart) return axios.put(`${Config.baseApiUrl}/api/carts/${userEmail}`, updatedCart)
} }
import axios from 'axios' import axios from 'axios'
export const sendOrderPost = (order) => { export const sendOrderPost = (order) => {
return axios.post("http://localhost:8080/api/orders", order) return axios.post(`${Config.baseApiUrl}/api/orders`, order)
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment