mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 20:28:46 -05:00
add to book reimplemented
This commit is contained in:
@@ -28,6 +28,25 @@ export function apiLogCooking(cook_log) {
|
||||
})
|
||||
}
|
||||
|
||||
export function apiLoadCookBooks(query) {
|
||||
return axios.get(resolveDjangoUrl('api:recipebook-list') + '?query=' + query).then((response) => {
|
||||
console.log(response)
|
||||
return response.data
|
||||
}).catch((err) => {
|
||||
handleError(err, 'There was an error creating a resource!', 'danger')
|
||||
})
|
||||
}
|
||||
|
||||
export function apiAddRecipeBookEntry(entry) {
|
||||
return axios.post(resolveDjangoUrl('api:recipebookentry-list',), entry).then((response) => {
|
||||
console.log(response)
|
||||
makeToast('Saved', 'Recipe Book entry saved!', 'success')
|
||||
}).catch((err) => {
|
||||
handleError(err, 'There was an error creating a resource!', 'danger')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function handleError(error, message) {
|
||||
if ('response' in error) {
|
||||
console.log(error.response)
|
||||
|
||||
Reference in New Issue
Block a user