This commit is contained in:
Rehan Dalal 2017-05-11 12:25:55 -04:00
Родитель bcabe0021c
Коммит ff2b092023
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 410D198EEF339E0B
1 изменённых файлов: 24 добавлений и 2 удалений

Просмотреть файл

@ -90,7 +90,7 @@ export function createRecipe(recipeData) {
export function updateRecipe(pk, recipeData) {
return async dispatch => {
const requestId = `update-recipe-${pk}`;
const recipe = await dispatch(makeApiRequest(requestId, `v2/recipe/${pk}`, {
const recipe = await dispatch(makeApiRequest(requestId, `v2/recipe/${pk}/`, {
method: 'PATCH',
data: recipeData,
}));
@ -103,7 +103,7 @@ export function deleteRecipe(pk) {
return async dispatch => {
const requestId = `delete-recipe-${pk}`;
await dispatch(makeApiRequest(requestId, `v2/recipe/${pk}`, {
await dispatch(makeApiRequest(requestId, `v2/recipe/${pk}/`, {
method: 'DELETE',
}));
@ -115,6 +115,28 @@ export function deleteRecipe(pk) {
}
export function enableRecipe(pk) {
return async dispatch => {
const requestId = `enable-recipe-${pk}`;
const recipe = await dispatch(makeApiRequest(requestId, `v2/recipe/${pk}/enable/`, {
method: 'POST',
}));
dispatch(recipeReceived(recipe));
};
}
export function disableRecipe(pk) {
return async dispatch => {
const requestId = `enable-recipe-${pk}`;
const recipe = await dispatch(makeApiRequest(requestId, `v2/recipe/${pk}/disable/`, {
method: 'POST',
}));
dispatch(recipeReceived(recipe));
};
}
export function fetchRecipeHistory(pk) {
return async dispatch => {
const requestId = `fetch-recipe-history-${pk}`;