feat: add user context to sentry.io reports
This commit is contained in:
parent
8691ca0453
commit
b02a051223
4 changed files with 36 additions and 16 deletions
|
@ -1 +1,2 @@
|
||||||
VUE_APP_BASE_URL=https://associations.espacecondorcet.org
|
VUE_APP_BASE_URL=https://associations.espacecondorcet.org
|
||||||
|
VUE_APP_SENTRY_URL=https://wow.com
|
|
@ -77,6 +77,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import * as Sentry from '@sentry/browser'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
drawer: null,
|
drawer: null,
|
||||||
|
@ -111,6 +113,10 @@ export default {
|
||||||
window.localStorage.setItem('adminToken', adminToken)
|
window.localStorage.setItem('adminToken', adminToken)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.enabled = true
|
this.enabled = true
|
||||||
|
|
||||||
|
// set sentry meta data to debug
|
||||||
|
Sentry.setTag('user.type', 'admin')
|
||||||
|
Sentry.setUser({type: "admin"})
|
||||||
// this.$store.commit('ADD_ALERT', {
|
// this.$store.commit('ADD_ALERT', {
|
||||||
// color: 'success',
|
// color: 'success',
|
||||||
// text: 'Vous voilà connecté !'
|
// text: 'Vous voilà connecté !'
|
||||||
|
|
|
@ -254,6 +254,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import * as Sentry from '@sentry/browser'
|
||||||
import Preview from '../components/Preview'
|
import Preview from '../components/Preview'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -348,6 +349,29 @@ export default {
|
||||||
this.$apitator.setAuthorizationToken(delegateToken)
|
this.$apitator.setAuthorizationToken(delegateToken)
|
||||||
// verify the token
|
// verify the token
|
||||||
this.$apitator.get('/delegate', { withAuth: true }).then(res => {
|
this.$apitator.get('/delegate', { withAuth: true }).then(res => {
|
||||||
|
const organization = res.data.data.organization
|
||||||
|
const proposedVersion = res.data.data.organization.proposedVersion
|
||||||
|
const tags = res.data.data.tags
|
||||||
|
|
||||||
|
const organizationMeta = {
|
||||||
|
_id: organization._id,
|
||||||
|
adminName: organization.adminName,
|
||||||
|
email: organization.email,
|
||||||
|
slug: organization.slugs[organization.slugs.length - 1],
|
||||||
|
publicUrl: process.env.VUE_APP_BASE_URL + '/association/' + organization.slugs[organization.slugs.length - 1],
|
||||||
|
validationState: organization.validationState,
|
||||||
|
rejectionDescription: organization.rejectionDescription,
|
||||||
|
publishedAt: organization.publishedAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// set sentry meta data to debug
|
||||||
|
Sentry.setUser({
|
||||||
|
type: 'delegate',
|
||||||
|
organization: organizationMeta
|
||||||
|
})
|
||||||
|
Sentry.setTag('user.type', 'delegate')
|
||||||
|
Sentry.setTag('organization.id', organization._id)
|
||||||
|
|
||||||
window.localStorage.setItem('delegateToken', delegateToken)
|
window.localStorage.setItem('delegateToken', delegateToken)
|
||||||
if (this.token !== '') {
|
if (this.token !== '') {
|
||||||
this.$router.push({ query: { delegateToken: this.token } })
|
this.$router.push({ query: { delegateToken: this.token } })
|
||||||
|
@ -355,18 +379,7 @@ export default {
|
||||||
clearTimeout(this.loadingHandle)
|
clearTimeout(this.loadingHandle)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.enabled = true
|
this.enabled = true
|
||||||
const organization = res.data.data.organization
|
this.$store.commit('SET_DELEGATE', organizationMeta)
|
||||||
const proposedVersion = res.data.data.organization.proposedVersion
|
|
||||||
const tags = res.data.data.tags
|
|
||||||
this.$store.commit('SET_DELEGATE', {
|
|
||||||
_id: organization._id,
|
|
||||||
adminName: organization.adminName,
|
|
||||||
email: organization.email,
|
|
||||||
slug: organization.slugs[organization.slugs.length - 1],
|
|
||||||
publicUrl: process.env.VUE_APP_BASE_URL + '/association/' + organization.slugs[organization.slugs.length - 1],
|
|
||||||
validationState: organization.validationState,
|
|
||||||
rejectionDescription: organization.rejectionDescription
|
|
||||||
})
|
|
||||||
this.$store.commit('SET_DATA', proposedVersion)
|
this.$store.commit('SET_DATA', proposedVersion)
|
||||||
this.$store.commit('SET_TAGS', tags)
|
this.$store.commit('SET_TAGS', tags)
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|
|
@ -17,9 +17,9 @@ import * as Sentry from '@sentry/browser'
|
||||||
import { Vue as VueIntegration } from '@sentry/integrations'
|
import { Vue as VueIntegration } from '@sentry/integrations'
|
||||||
import { Integrations } from '@sentry/tracing'
|
import { Integrations } from '@sentry/tracing'
|
||||||
|
|
||||||
if (process.env.VUE_APP_DISABLE_SENTRY === undefined) {
|
if (process.env.VUE_APP_SENTRY_URL != null) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn: 'https://e69f240d55414b0ca7763773c2fe3a24@o315435.ingest.sentry.io/5410664',
|
dsn: process.env.VUE_APP_SENTRY_URL,
|
||||||
integrations: [
|
integrations: [
|
||||||
new VueIntegration({ Vue, tracing: true }),
|
new VueIntegration({ Vue, tracing: true }),
|
||||||
new Integrations.BrowserTracing()
|
new Integrations.BrowserTracing()
|
||||||
|
@ -40,7 +40,7 @@ Vue.filter('formatDate', (s: string) => {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
const d = new Date(s)
|
const d = new Date(s)
|
||||||
return d.toLocaleString('fr-FR', { timeZone: 'Europe/Paris' })
|
return d.toLocaleString('en-GB', { timeZone: 'Europe/Paris' })
|
||||||
})
|
})
|
||||||
Vue.use(TiptapVuetifyPlugin, {
|
Vue.use(TiptapVuetifyPlugin, {
|
||||||
vuetify,
|
vuetify,
|
||||||
|
|
Loading…
Reference in a new issue