Compare commits
2 Commits
dcf516f2de
...
fix/save-t
| Author | SHA1 | Date | |
|---|---|---|---|
| b07b97bf1e | |||
| 2ab192c3ba |
@@ -350,6 +350,7 @@ import { useUiStore } from '../stores/ui'
|
||||
import { useDiaryStore } from '../stores/diary'
|
||||
import { api } from '../composables/useApi'
|
||||
import { oilEn, recipeNameEn } from '../composables/useOilTranslation'
|
||||
import { showPrompt } from '../composables/useDialog'
|
||||
// TagPicker replaced with inline tag editing
|
||||
|
||||
const props = defineProps({
|
||||
@@ -576,16 +577,16 @@ async function saveToDiary() {
|
||||
ui.openLogin()
|
||||
return
|
||||
}
|
||||
const name = prompt('保存为我的配方,名称:', recipe.value.name)
|
||||
const name = await showPrompt('保存为我的配方,名称:', recipe.value.name)
|
||||
if (!name) return
|
||||
try {
|
||||
await api.post('/api/diary', {
|
||||
await recipesStore.saveRecipe({
|
||||
name,
|
||||
source_recipe_id: recipe.value._id || null,
|
||||
ingredients: recipe.value.ingredients.map(i => ({ oil: i.oil, drops: i.drops })),
|
||||
note: recipe.value.note || '',
|
||||
ingredients: recipe.value.ingredients.map(i => ({ oil_name: i.oil, drops: i.drops })),
|
||||
tags: recipe.value.tags || [],
|
||||
})
|
||||
ui.showToast('已保存到「我的配方日记」')
|
||||
ui.showToast('已保存到「我的配方」')
|
||||
} catch (e) {
|
||||
ui.showToast('保存失败: ' + (e?.message || '未知错误'))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user