Resume pending action after login (favorite, diary, QR upload)
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 4s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Failing after 1m4s

Add pendingAction callback to UI store. When user clicks favorite,
save-to-diary, or upload QR while not logged in, the action is stored
and automatically executed after successful login/register instead of
reloading the page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 22:39:59 +00:00
parent 5eba04a1fa
commit 96504ed1d7
3 changed files with 23 additions and 6 deletions

View File

@@ -490,7 +490,7 @@ const showBrandHint = computed(() =>
function goUploadQr() {
if (!authStore.isLoggedIn) {
ui.openLogin()
ui.openLogin(() => goUploadQr())
return
}
if (recipe.value._id) {
@@ -606,7 +606,7 @@ function getCardRecipeName() {
// ---- Favorite ----
async function handleToggleFavorite() {
if (!authStore.isLoggedIn) {
ui.openLogin()
ui.openLogin(() => handleToggleFavorite())
return
}
if (!recipe.value._id) {
@@ -625,7 +625,7 @@ async function handleToggleFavorite() {
// ---- Save to diary ----
async function saveToDiary() {
if (!authStore.isLoggedIn) {
ui.openLogin()
ui.openLogin(() => saveToDiary())
return
}
const name = prompt('保存为我的配方,名称:', recipe.value.name)