104a6 utm tracking in db (#578)

* utm tracking in db

* fix array key bug

* fix utm form

* fix import
This commit is contained in:
Favour Olayinka
2024-09-20 10:47:12 +01:00
committed by GitHub
parent 5020f9fa74
commit 5ab3477e0a
2 changed files with 10 additions and 9 deletions

View File

@@ -33,6 +33,7 @@
import { useNuxtApp } from "nuxt/app";
const { $utm } = useNuxtApp();
const router = useRouter()
const route = useRoute()
const authStore = useAuthStore()
@@ -40,6 +41,10 @@ const workspacesStore = useWorkspacesStore()
const formsStore = useFormsStore()
const logEvent = useAmplitude().logEvent
const loading = ref(true)
const form = useForm({
code: '',
utm_data: null,
})
definePageMeta({
alias: '/oauth/:provider/callback'
@@ -47,15 +52,10 @@ definePageMeta({
function handleCallback() {
const code = route.query.code
const provider = route.params.provider
opnFetch(`/oauth/${provider}/callback`, {
method: 'POST',
params: {
code,
utm_data: $utm.value
}
}).then(async (data) => {
form.code = route.query.code
form.utm_data = $utm.value
form.post(`/oauth/${provider}/callback`).then(async (data) => {
authStore.setToken(data.token)
const [userDataResponse, workspacesResponse] = await Promise.all([
opnFetch("user"),