From ad97ba68b004b746d1e78cedc87a2dab9b93d3c5 Mon Sep 17 00:00:00 2001 From: vantezzen Date: Thu, 17 Oct 2019 21:45:24 +0200 Subject: Fix compatability to Postgresql databases --- app/Controllers/Http/RecipeController.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/Controllers/Http/RecipeController.js') diff --git a/app/Controllers/Http/RecipeController.js b/app/Controllers/Http/RecipeController.js index 880f0c3..6c8aa21 100644 --- a/app/Controllers/Http/RecipeController.js +++ b/app/Controllers/Http/RecipeController.js @@ -35,7 +35,7 @@ class RecipeController { const customRecipes = customRecipesArray.map((recipe) => ({ id: recipe.recipeId, name: recipe.name, - ...JSON.parse(recipe.data), + ...typeof recipe.data === "string" ? JSON.parse(recipe.data) : recipe.data, })); const recipes = [ @@ -144,7 +144,7 @@ class RecipeController { results = dbResults.map((recipe) => ({ id: recipe.recipeId, name: recipe.name, - ...JSON.parse(recipe.data), + ...typeof recipe.data === "string" ? JSON.parse(recipe.data) : recipe.data, })); } else { let remoteResults = []; @@ -155,7 +155,7 @@ class RecipeController { const localResults = localResultsArray.map((recipe) => ({ id: recipe.recipeId, name: recipe.name, - ...JSON.parse(recipe.data), + ...typeof recipe.data === "string" ? JSON.parse(recipe.data) : recipe.data, })); results = [ -- cgit v1.2.3-70-g09d2