fixed access for shared recipes

This commit is contained in:
vabene1111
2021-01-13 22:59:19 +01:00
parent 910dc29f06
commit 50829dce47
4 changed files with 11 additions and 6 deletions

View File

@ -6,11 +6,15 @@ axios.defaults.xsrfCookieName = 'csrftoken'
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN"
export function apiLoadRecipe(recipe_id) {
return axios.get(resolveDjangoUrl('api:recipe-detail', recipe_id)).then((response) => {
let url = resolveDjangoUrl('api:recipe-detail', recipe_id)
if (window.SHARE_UID !== undefined) {
url += '?share=' + window.SHARE_UID
}
return axios.get(url).then((response) => {
return response.data
}).catch((err) => {
console.log(err.response)
makeToast('Error', 'There was an error loading a resource!', 'danger')
handleError(err, 'There was an error loading a resource!', 'danger')
})
}