diff --git a/TODO.md b/TODO.md index 9171418..cfb852c 100644 --- a/TODO.md +++ b/TODO.md @@ -4,5 +4,4 @@ - Create user - add API with API docs - Notifications infrastructure -- Anonymous feedback claiming - Create widgets for users to embed on their website \ No newline at end of file diff --git a/pages/dashboard/index.vue b/pages/dashboard/index.vue index b5fbe31..0cc1e0b 100644 --- a/pages/dashboard/index.vue +++ b/pages/dashboard/index.vue @@ -282,6 +282,10 @@ export default { try { this.isLoading = true + // Merge any anonymous feedback/votes into the authenticated account. + // This covers the OAuth redirect flow where login/signup pages aren't involved. + $fetch('/api/auth/merge-anonymous', { method: 'POST' }).catch(() => {}) + const [sessionResult, orgsResult] = await Promise.all([ authClient.useSession(useFetch), authClient.organization.list().catch(() => ({ data: [] })), diff --git a/pages/login/index.vue b/pages/login/index.vue index 48cc680..40e85ff 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -135,6 +135,7 @@ export default { if (result.error) { this.error = result.error.message || 'Sign in failed' } else { + $fetch('/api/auth/merge-anonymous', { method: 'POST' }).catch(() => {}) const redirect = this.$route.query.redirect await navigateTo(redirect && typeof redirect === 'string' && redirect.startsWith('/') ? redirect : '/dashboard') } diff --git a/pages/signup/index.vue b/pages/signup/index.vue index 7341590..294fe80 100644 --- a/pages/signup/index.vue +++ b/pages/signup/index.vue @@ -146,6 +146,7 @@ export default { if (result.error) { this.error = result.error.message || 'Sign up failed' } else { + $fetch('/api/auth/merge-anonymous', { method: 'POST' }).catch(() => {}) const redirect = this.$route.query.redirect await navigateTo(redirect && typeof redirect === 'string' && redirect.startsWith('/') ? redirect : '/dashboard') }