class Recipe {
private title: string = "";
private ingredients: RecipeIngredient[] = [];
private description: string = "";
get Title() {
return this.title || "";
}
get Ingredients() {
return this.ingredients || [];
}
get Description() {
return this.description || "";
}
set Title(title: string) {
this.title = title;
}
set Description(description: string) {
this.description = description;
}
constructor(recipeDetails: { title?: string, description?: string, ingredients?: RecipeIngredient[] } = { title: "", description: "", ingredients: [] }) {
for (let key in recipeDetails) {
this[key as keyof typeof recipeDetails] = recipeDetails[key as keyof typeof recipeDetails];
}
}
}
constructor(recipeDetails: { title?: string, description?: string, ingredients?: RecipeIngredient[] } = { title: "", description: "", ingredients: [] }) {
for (let key in recipeDetails) {
this[key as keyof typeof recipeDetails] = recipeDetails[key as keyof typeof recipeDetails];
}
}
"proxy": "http://localhost:5000/api",
, потом вебпаком в public к серваку. Я так делаю. Не скажу что так правильно, но можно попробовать)