fixed access for shared recipes
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -65,9 +65,10 @@
|
|||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
window.RECIPE_ID = {{recipe.pk}};
|
window.RECIPE_ID = {{recipe.pk}};
|
||||||
window.USER_SERVINGS = {{ user_servings }};
|
window.USER_SERVINGS = {{ user_servings }};
|
||||||
|
window.SHARE_UID = '{{ share }}';
|
||||||
window.USER_PREF = {
|
window.USER_PREF = {
|
||||||
'use_fractions': {% if request.user.userpreference.use_fractions %} true {% else %} false {% endif %},
|
'use_fractions': {% if request.user.userpreference.use_fractions %} true {% else %} false {% endif %},
|
||||||
'ingredient_decimals': {{ request.user.userpreference.ingredient_decimals }},
|
'ingredient_decimals': {% if request.user.userpreference.use_fractions %} {{ request.user.userpreference.ingredient_decimals }} {% else %} 2 {% endif %},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -6,11 +6,15 @@ axios.defaults.xsrfCookieName = 'csrftoken'
|
|||||||
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN"
|
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN"
|
||||||
|
|
||||||
export function apiLoadRecipe(recipe_id) {
|
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
|
return response.data
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err.response)
|
handleError(err, 'There was an error loading a resource!', 'danger')
|
||||||
makeToast('Error', 'There was an error loading a resource!', 'danger')
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
{"status":"compiling","publicPath":"http://localhost:8080/"}
|
{"status":"done","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.css","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\css\\chunk-vendors.css"},{"name":"js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"recipe_view":[{"name":"js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"}]}}
|
Reference in New Issue
Block a user