Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(cloud): focus sign-in code after loading and force error retries

coderabbitai[bot]00bd0502c6b8
diff --git a/apps/cloud/app/error.vue b/apps/cloud/app/error.vue
index 49367419..4b038c24 100644
--- a/apps/cloud/app/error.vue
+++ b/apps/cloud/app/error.vue
@@ -32,7 +32,7 @@ const notFound = computed(() => props.error.statusCode === 404)
><ArrowLeft :size="15" />Back to home</CloudButton
><CloudButton
v-if="!notFound"
- @click="reloadNuxtApp()"
+ @click="reloadNuxtApp({ force: true })"
><RotateCw :size="15" />Try again</CloudButton
>
</div>
diff --git a/apps/cloud/app/pages/signin.vue b/apps/cloud/app/pages/signin.vue
index 37acd6be..ec7c891f 100644
--- a/apps/cloud/app/pages/signin.vue
+++ b/apps/cloud/app/pages/signin.vue
@@ -23,6 +23,7 @@ async function submit() {
if (busy.value || !status.value?.enabled) return
busy.value = true
error.value = ''
+ let focusCode = false
try {
if (!challenge.value) {
const result = await $fetch('/api/auth/email/request', {
@@ -30,8 +31,7 @@ async function submit() {
body: { email: email.value },
})
challenge.value = result.challengeId
- await nextTick()
- codeInput.value?.$el?.focus()
+ focusCode = true
} else {
await $fetch('/api/auth/email/verify', {
method: 'POST',
@@ -54,6 +54,10 @@ async function submit() {
} finally {
busy.value = false
}
+ if (focusCode) {
+ await nextTick()
+ codeInput.value?.$el?.focus()
+ }
}
</script>
<template>