mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 04:55:21 +02:00
create new recipe without image
This commit is contained in:
parent
1aa9cbeebb
commit
8dc7f0663d
1 changed files with 9 additions and 2 deletions
|
@ -83,12 +83,19 @@ export default {
|
||||||
onFileChange() {
|
onFileChange() {
|
||||||
this.image = URL.createObjectURL(this.fileObject);
|
this.image = URL.createObjectURL(this.fileObject);
|
||||||
},
|
},
|
||||||
|
|
||||||
async createRecipe() {
|
async createRecipe() {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.recipeDetails.image = this.fileObject.name;
|
|
||||||
|
if (this.fileObject) {
|
||||||
|
this.recipeDetails.image = this.fileObject.name;
|
||||||
|
}
|
||||||
let slug = await api.recipes.create(this.recipeDetails);
|
let slug = await api.recipes.create(this.recipeDetails);
|
||||||
|
|
||||||
await api.recipes.updateImage(slug, this.fileObject);
|
if (this.fileObject) {
|
||||||
|
await api.recipes.updateImage(slug, this.fileObject);
|
||||||
|
}
|
||||||
|
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
|
||||||
this.$router.push(`/recipe/${slug}`);
|
this.$router.push(`/recipe/${slug}`);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue