fix: 贡献统计共享后实时更新
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Failing after 53s
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Failing after 53s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1029,6 +1029,16 @@ async function saveAllParsed() {
|
||||
}
|
||||
|
||||
const sharedCount = ref({ adopted: 0, total: 0 })
|
||||
|
||||
async function loadContribution() {
|
||||
try {
|
||||
const res = await api('/api/me/contribution')
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
sharedCount.value = { adopted: data.adopted_count || 0, total: data.shared_count || 0 }
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
const previewRecipeIndex = ref(null)
|
||||
const showBatchMenu = ref(false)
|
||||
const showBatchTagPicker = ref(false)
|
||||
@@ -1065,13 +1075,7 @@ function formatDate(d) {
|
||||
onMounted(async () => {
|
||||
if (auth.isLoggedIn) {
|
||||
await diaryStore.loadDiary()
|
||||
try {
|
||||
const res = await api('/api/me/contribution')
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
sharedCount.value = { adopted: data.adopted_count || 0, total: data.shared_count || 0 }
|
||||
}
|
||||
} catch {}
|
||||
await loadContribution()
|
||||
}
|
||||
if (auth.isAdmin) {
|
||||
try {
|
||||
@@ -1159,6 +1163,7 @@ async function shareDiaryToPublic(diary) {
|
||||
ui.showToast('已提交,等待管理员审核')
|
||||
}
|
||||
await recipeStore.loadRecipes()
|
||||
await loadContribution()
|
||||
}
|
||||
} catch {
|
||||
ui.showToast('共享失败')
|
||||
|
||||
Reference in New Issue
Block a user