|
|
|
@ -60,6 +60,11 @@ async function handleLogin() { |
|
|
|
}) |
|
|
|
$toast.success('登录成功!') |
|
|
|
await refresh(true) |
|
|
|
try { |
|
|
|
await $fetch('/api/agent/migrate', { method: 'POST' }) |
|
|
|
} catch (e) { |
|
|
|
console.error('迁移临时会话失败', e) |
|
|
|
} |
|
|
|
await navigateTo(redirect.value) |
|
|
|
} catch (e: any) { |
|
|
|
$toast.error(e?.data?.statusMessage || e?.message || '登录失败') |
|
|
|
@ -69,12 +74,17 @@ async function handleLogin() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(async () => { |
|
|
|
fetchCaptcha() |
|
|
|
|
|
|
|
const url = new URL(window.location.href) |
|
|
|
if (url.searchParams.get('oauth_success') === '1') { |
|
|
|
refresh(true) |
|
|
|
await refresh(true) |
|
|
|
try { |
|
|
|
await $fetch('/api/agent/migrate', { method: 'POST' }) |
|
|
|
} catch (e) { |
|
|
|
console.error('迁移临时会话失败', e) |
|
|
|
} |
|
|
|
router.push('/') |
|
|
|
} |
|
|
|
if (url.searchParams.get('oauth_error')) { |
|
|
|
|