Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | <script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { useAuthStore } from '@/stores/auth'
const { t } = useI18n()
const router = useRouter()
const auth = useAuthStore()
const error = ref(false)
onMounted(async () => {
try {
const returnPath = await auth.handleCallback()
await router.replace(returnPath)
} catch (e) {
error.value = true
}
})
function retry() {
void auth.login('/')
}
</script>
<template>
<div class="py-16 text-center">
<template v-if="!error">
<h1 class="text-lg font-semibold">{{ t('auth.callbackTitle') }}</h1>
<p class="mt-2 text-sm text-slate-500">{{ t('auth.callbackDesc') }}</p>
</template>
<template v-else>
<h1 class="text-lg font-semibold">{{ t('auth.callbackTitle') }}</h1>
<p class="mt-2 text-sm text-slate-500">{{ t('auth.callbackError') }}</p>
<button
class="mt-4 rounded-lg bg-brand-600 px-4 py-2 text-sm text-white"
@click="retry"
>
{{ t('auth.login') }}
</button>
</template>
</div>
</template>
|