Переглянути джерело

Fix 'uncontrolled to controlled input error' after filling author's website

Tatiana Inama 6 роки тому
батько
коміт
87349c7434

+ 2 - 1
ktchn/src/recipes/scrape/sources/all-recipes.ts

@@ -58,7 +58,8 @@ const AR_CONFIG = {
   scrapeRecipe: ($: CheerioSelector): Recipe => ({
     name: getText($)(SELECTORS.TITLE),
     author: {
-      name: getText($)(SELECTORS.AUTHOR)
+      name: getText($)(SELECTORS.AUTHOR),
+      website: 'https://www.allrecipes.com',
     },
     details: getRecipeDetails($),
     ingredients: getIngredients($),

+ 1 - 1
ktchn/src/recipes/scrape/sources/home-cooking-adventure.ts

@@ -62,7 +62,7 @@ const HCA_CONFIG = {
   website: 'https://www.homecookingadventure.com',
   scrapeRecipe: ($: CheerioSelector): Recipe => ({
     name: getRecipeName($),
-    author: { name: 'Home Cooking Adventure' },
+    author: { name: 'Home Cooking Adventure', website: 'https://www.homecookingadventure.com' },
     details: getRecipeDetails($),
     ingredients: getIngredients($),
     instructions: getInstructions($),

+ 1 - 1
ktchn/src/recipes/scrape/sources/index.ts

@@ -9,7 +9,7 @@ import { Recipe } from '../../model';
 export interface ScrapingSource {
   name: string,
   domain: string,
-  website?: string,
+  website: string,
   scrapeRecipe($: CheerioSelector): Recipe,
 }
 

+ 1 - 1
ktchn/src/recipes/scrape/sources/joy-of-baking.ts

@@ -48,7 +48,7 @@ function getInstructions($: CheerioSelector): string[] {
 const JOB_CONFIG = {
   name: 'Joy of Baking',
   domain: 'joyofbaking',
-  website: JOB_AUTHOR_DATA.website,
+  website: JOB_AUTHOR_DATA.website || '',
   scrapeRecipe: ($: CheerioSelector): Recipe => {
     return {
       name: getRecipeName($),

+ 1 - 1
ktchn/src/recipes/scrape/sources/just-one-cookbook.ts

@@ -72,7 +72,7 @@ const JOC_CONFIG = {
   website: 'https://www.justonecookbook.com',
   scrapeRecipe: ($: CheerioSelector): Recipe => ({
     name: getText($)(SELECTORS.TITLE),
-    author: { name: 'Nami' },
+    author: { name: 'Nami', website: 'https://www.justonecookbook.com' },
     details: getRecipeDetails($),
     ingredients: getIngredients($),
     instructions: getTextList($)(SELECTORS.INSTRUCTIONS),

+ 1 - 1
ktchn/src/recipes/scrape/sources/laura-in-the-kitchen.ts

@@ -64,7 +64,7 @@ const getImage = ($: CheerioSelector) => {
 const LITK_CONFIG = {
   name: 'Laura in the Kitchen',
   domain: 'laurainthekitchen',
-  website: LITK_AUTHOR_DATA.website,
+  website: LITK_AUTHOR_DATA.website || '',
   scrapeRecipe: ($: CheerioSelector): Recipe => ({
     name: getText($)(SELECTORS.TITLE),
     author: LITK_AUTHOR_DATA,