web client v1.0 (production)

This commit is contained in:
2020-10-08 21:29:06 +02:00
parent d0dab37649
commit 20c7dd18a7
22 changed files with 289 additions and 33 deletions

View File

@@ -92,6 +92,13 @@ const setDishes = (data) => {
};
};
const setDish = (data) => {
return {
type: "SET_DISH",
payload: data,
};
};
export const fetchAllDishes = (id) => {
return function (dispatch) {
axios
@@ -103,6 +110,20 @@ export const fetchAllDishes = (id) => {
};
};
export const fetchDish = (id) => {
return function (dispatch) {
axios
.get(backend + "dish/?dishId=" + id)
.then((response) => {
dispatch(setDish(response.data));
})
.catch((err) => {
dispatch(notification("Nie udało się pobrać :(", "error"));
dispatch(push("/"));
});
};
};
export const refreshUserData = (token) => {
return function (dispatch) {
axios({