website now works

This commit is contained in:
polv committed 2020-12-16 05:00:20 +07:00
1 parent ce56fcb91c
commit 3daa9f82e7
15 files changed
+241 -137

No files matched your search

+11 -1
View File
@@ -9,16 +9,26 @@
<script lang="ts">
import { Vue, Component } from 'nuxt-property-decorator'
import { api } from '~/assets/global'
@Component<BlogPage>({
watch: {
'$route.query.q': '$fetch',
'$route.query.page': '$fetch',
},
async fetch() {
const { result, count } = await this.$axios.$get('/api/q', {
const { result, count, error } = await api('/api/q', {
params: {
q: this.$route.query.q,
page: this.$route.query.page,
},
})
if (error) {
this.$nuxt.error(error)
return
}
this.posts = result
this.count = count
},