refactor: switch to fastapi backend

This commit is contained in:
2026-07-18 14:48:45 +08:00
parent 9fd47e01f5
commit 613452b7fe
22 changed files with 701 additions and 1342 deletions
+11 -10
View File
@@ -1,9 +1,10 @@
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { useRoute, useRouter } from 'vue-router'
import { NButton, NCard, NResult, NSpin } from 'naive-ui'
import { createDetachedAuthClient, resolveEmailAuthCallback } from '@/lib/authEmail'
import { apiRequest } from '@/lib/api'
const route = useRoute()
const router = useRouter()
const state = ref<'loading' | 'success' | 'failed'>('loading')
@@ -22,18 +23,18 @@ function startCountdown() {
onMounted(async () => {
try {
const confirmClient = createDetachedAuthClient()
const result = await resolveEmailAuthCallback({
client: confirmClient,
allowedTypes: ['signup', 'email'],
})
if (!result.ok) {
const token = typeof route.query.token === 'string' ? route.query.token : ''
if (!token) {
state.value = 'failed'
return
}
await confirmClient.auth.signOut()
await apiRequest('/auth/confirm-email', {
method: 'POST',
auth: false,
body: { token },
})
window.history.replaceState(null, '', window.location.pathname)
state.value = 'success'
startCountdown()
} catch {