Migrating amplitude and crisp plugin/composable

This commit is contained in:
Julien Nahum
2023-12-09 16:33:56 +01:00
parent 1f853e8178
commit 12778fad34
8 changed files with 72 additions and 51 deletions

View File

@@ -38,6 +38,7 @@ export const useAuthStore = defineStore('auth', {
try {
const { data } = await axios.get('/api/user')
this.user = data
this.initServiceClients()
return data
} catch (e) {
@@ -50,7 +51,11 @@ export const useAuthStore = defineStore('auth', {
this.user = payload
},
load
initServiceClients() {
if (!this.user) return
useAmplitude().setUser(this.user)
useCrisp().setUser(this.user)
},
async logout () {
try {