summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-12-14 14:07:36 -0500
committerTucker Evans <tuckerevans24@gmail.com>2019-12-14 16:02:55 -0500
commit9ed977689fe92e514e83eec43ff809e89a460129 (patch)
treea5bc47ad5c4b5ef97f0098180acf46b3f7af5932
parent4ec8cbd63deb6cb8b24db58b36ecd4a3ccdda79e (diff)
Fix changes made for demo
Changes reloading times so recipes are successfully added/deleted. Adds checked/cart_index to Ingredient on DataModel
-rw-r--r--recipeBuddy/src/app/DataModels/ingredient.ts2
-rw-r--r--recipeBuddy/src/app/add-recipe/add-recipe.component.ts3
-rw-r--r--recipeBuddy/src/app/recipe-card/recipe-card.component.ts3
-rw-r--r--recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts4
4 files changed, 5 insertions, 7 deletions
diff --git a/recipeBuddy/src/app/DataModels/ingredient.ts b/recipeBuddy/src/app/DataModels/ingredient.ts
index 720514c..f755c0c 100644
--- a/recipeBuddy/src/app/DataModels/ingredient.ts
+++ b/recipeBuddy/src/app/DataModels/ingredient.ts
@@ -3,6 +3,8 @@ export class Ingredient {
public amount: number;
public unit: string;
public type_: string;
+ public cart_index: number;
+ public checked: boolean;
public constructor(name: string, amount: number, unit: string, type_: string) {
this.name = name;
diff --git a/recipeBuddy/src/app/add-recipe/add-recipe.component.ts b/recipeBuddy/src/app/add-recipe/add-recipe.component.ts
index 3c32ae7..d27998a 100644
--- a/recipeBuddy/src/app/add-recipe/add-recipe.component.ts
+++ b/recipeBuddy/src/app/add-recipe/add-recipe.component.ts
@@ -124,7 +124,8 @@ export class AddRecipeComponent {
formData.tags.split(',').filter(word=> !(word==="")), //tags
formData.photos.split(',').filter(word=> !(word==="")) //photos
);
- this.restService.createRecipe(recipe).subscribe();
+ this.restService.createRecipe(recipe).subscribe(res => {
this.router.navigate(['/']);
+ }, err => console.log(err));
}
}
diff --git a/recipeBuddy/src/app/recipe-card/recipe-card.component.ts b/recipeBuddy/src/app/recipe-card/recipe-card.component.ts
index 490f2ab..bb6fc9a 100644
--- a/recipeBuddy/src/app/recipe-card/recipe-card.component.ts
+++ b/recipeBuddy/src/app/recipe-card/recipe-card.component.ts
@@ -63,9 +63,8 @@ export class RecipeCardComponent implements OnInit {
if(txt == true)
{
alert(this.recipe.name + " was deleted.");
- this.restService.deleteRecipe(id).subscribe();
+ this.restService.deleteRecipe(id).subscribe(res=> window.location.reload(), err => console.log(err));
}
- window.location.reload();
}
}
diff --git a/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts
index b60a63c..dbaf1c0 100644
--- a/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts
+++ b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts
@@ -6,10 +6,6 @@ import { FormsModule } from '@angular/forms';
import { Recipe } from '../DataModels/recipe';
import { Ingredient } from '../DataModels/ingredient';
-
-
-
-
@Component({
selector: 'shopping-cart.component',
templateUrl: './shopping-cart.component.html',