Import Sentry

This commit is contained in:
2021-04-27 21:47:26 +02:00
parent 6e45298506
commit c202252f3b
16 changed files with 334 additions and 31 deletions

View File

@@ -26,9 +26,13 @@ import {InfoData} from "../../@types/types";
export default defineComponent({
name: "AboutPreview",
setup() {
const {$content} = useContext()
const {$content, $sentry} = useContext()
const info = useAsync(() => {
return $content('infos').fetch<InfoData>()
return $content('infos')
.fetch<InfoData>()
.catch((error) => {
$sentry.captureEvent(error)
})
})
return {

View File

@@ -76,7 +76,7 @@ export default defineComponent({
const error = ref(false)
const success = ref(false)
const {$axios} = useContext()
const {$axios, $sentry} = useContext()
const form = ref<Form>({} as Form)
const handleForm = async () => {
const {data} = await $axios.post('form',
@@ -97,6 +97,7 @@ export default defineComponent({
form.value = {} as Form
}, 5000)
} else {
$sentry.captureEvent(data)
error.value = true
setTimeout(() => {
error.value = false

View File

@@ -24,12 +24,15 @@ import {Experience} from "../../@types/types";
export default defineComponent({
name: "ExperiencesAbout",
setup() {
const {$content} = useContext()
const {$content, $sentry} = useContext()
const experiences = useAsync(() => {
return $content('experiences')
.sortBy('end_date', 'desc')
.fetch<Experience>()
.catch((error) => {
$sentry.captureEvent(error)
})
})
return {

View File

@@ -24,12 +24,15 @@ import {Formation} from "../../@types/types";
export default defineComponent({
name: "FormationsHome",
setup() {
const {$content} = useContext()
const {$content, $sentry} = useContext()
const formations = useAsync(() => {
return $content('formations')
.sortBy('end_date', 'desc')
.fetch<Formation>()
.catch((error) => {
$sentry.captureEvent(error)
})
})
return {

View File

@@ -36,13 +36,16 @@ import {Post} from "../../@types/types";
export default defineComponent({
name: "PostsHome",
setup() {
const { $content, i18n } = useContext()
const { $content, i18n, $sentry } = useContext()
const posts = useAsync(() => {
return $content(`articles/${i18n.locale}`)
.sortBy('date', 'asc')
.limit(3)
.fetch<Post>()
.catch((error) => {
$sentry.captureEvent(error)
})
}, 'posts')
return {

View File

@@ -34,12 +34,15 @@ import {Project} from "../../@types/types";
export default defineComponent({
name: "ProjectsHome",
setup() {
const { $content } = useContext()
const { $content, $sentry } = useContext()
const projects = useAsync(() => {
return $content(`projects`)
.limit(3)
.fetch<Project>()
.catch((error) => {
$sentry.captureEvent(error)
})
}, 'projects')
return {

View File

@@ -25,10 +25,14 @@ import {Skill} from "../../@types/types";
export default defineComponent({
name: "SkillsAbout",
setup() {
const {$content} = useContext()
const {$content, $sentry} = useContext()
const skills = useAsync(() => {
return $content('skills').fetch<Skill>()
return $content('skills')
.fetch<Skill>()
.catch((error) => {
$sentry.captureEvent(error)
})
})
return {

View File

@@ -119,7 +119,7 @@ export default defineComponent({
name: "blog",
head: {},
setup() {
const {$content, i18n, $axios, app, $storage} = useContext()
const {$content, i18n, $axios, app, $storage, $sentry} = useContext()
const route = useRoute()
const { title } = useMeta()
const slug = computed(() => route.value.params.slug)
@@ -127,8 +127,9 @@ export default defineComponent({
const post = useStatic((slug) => {
return $content(`articles/${i18n.locale}`, slug)
.fetch<Post>()
.catch(() => {
.catch((error) => {
app.error({statusCode: 404, message: "Post not found"});
$sentry.captureEvent(error)
}) as Promise<Post>
}, slug, 'post')
@@ -146,6 +147,8 @@ export default defineComponent({
}
}).then((response) => {
likes.value = response.data
}).catch((error) => {
$sentry.captureEvent(error)
})
})
@@ -160,6 +163,8 @@ export default defineComponent({
liked.value = false
likes.value = data.post.likes
$storage.removeCookie(`${slug.value}`)
} else {
$sentry.captureEvent(data)
}
} else {
const {data} = await $axios.post(`/posts/${post.value?.slug}/like`, {}, {
@@ -173,6 +178,8 @@ export default defineComponent({
$storage.setCookie(`${slug.value}`, true, {
maxAge: 60 * 60 * 5
})
} else {
$sentry.captureEvent(data)
}
}
}

View File

@@ -41,13 +41,16 @@ export default defineComponent({
}
},
setup() {
const { $content, i18n } = useContext()
const { $content, i18n, $sentry } = useContext()
const posts = useAsync(() => {
return $content(`articles/${i18n.locale}`)
.sortBy('date', 'asc')
.limit(10)
.fetch<Post>()
.catch((error) => {
$sentry.captureEvent(error)
})
})
return {

View File

@@ -37,9 +37,14 @@ export default {
title: 'Contact - Arthur Danjou'
},
setup() {
const {$content} = useContext()
const {$content, $sentry} = useContext()
const info = useAsync(() => {
return $content('infos').fetch<InfoData>() as Promise<InfoData>
return ($content('infos')
.fetch<InfoData>()
.catch((error) => {
$sentry.captureEvent(error)
})
)as Promise<InfoData>
})
const hiring_color = info && info.value?.hiring.color

View File

@@ -31,10 +31,14 @@ export default {
title: `Projects - Arthur Danjou`
},
setup() {
const { $content, i18n } = useContext()
const { $content, i18n, $sentry } = useContext()
const projects = useAsync(() => {
return $content('projects').fetch<Project>()
return $content('projects')
.fetch<Project>()
.catch((error) => {
$sentry.captureEvent(error)
})
})
useMeta( {