mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 04:55:21 +02:00
fix unauthorized recipe (#499)
This commit is contained in:
parent
0e42f7407d
commit
562cea341b
3 changed files with 6 additions and 3 deletions
|
@ -36,7 +36,8 @@ export const recipeAPI = {
|
||||||
|
|
||||||
async requestDetails(recipeSlug) {
|
async requestDetails(recipeSlug) {
|
||||||
let response = await apiReq.get(API_ROUTES.recipesRecipeSlug(recipeSlug));
|
let response = await apiReq.get(API_ROUTES.recipesRecipeSlug(recipeSlug));
|
||||||
return response.data;
|
if (response && response.data) return response.data;
|
||||||
|
else return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateImage(recipeSlug, fileObject, overrideSuccessMsg = false) {
|
updateImage(recipeSlug, fileObject, overrideSuccessMsg = false) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
$route: function () {
|
$route: function() {
|
||||||
this.getRecipeDetails();
|
this.getRecipeDetails();
|
||||||
this.checkPrintRecipe();
|
this.checkPrintRecipe();
|
||||||
},
|
},
|
||||||
|
@ -193,6 +193,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.recipeDetails = await api.recipes.requestDetails(this.currentRecipe);
|
this.recipeDetails = await api.recipes.requestDetails(this.currentRecipe);
|
||||||
|
if (!this.recipeDetails) router.push(`/login`);
|
||||||
this.skeleton = false;
|
this.skeleton = false;
|
||||||
},
|
},
|
||||||
getImage(slug) {
|
getImage(slug) {
|
||||||
|
|
|
@ -27,7 +27,8 @@ export const recipeRoutes = [
|
||||||
meta: {
|
meta: {
|
||||||
title: async route => {
|
title: async route => {
|
||||||
const recipe = await api.recipes.requestDetails(route.params.recipe);
|
const recipe = await api.recipes.requestDetails(route.params.recipe);
|
||||||
return recipe.name;
|
if (recipe && recipe.name) return recipe.name;
|
||||||
|
else return null;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue