mirror of
https://github.com/ArthurDanjou/website.git
synced 2026-01-20 15:01:45 +01:00
Working on oauth
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
export async function usePost(slug: string) {
|
||||
const {
|
||||
data: post,
|
||||
refresh: refreshPost,
|
||||
} = useFetch('/api/article', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
slug,
|
||||
},
|
||||
})
|
||||
|
||||
const likes = ref(post.value?.likes)
|
||||
const like = async () => {
|
||||
const { data } = await useFetch('/api/like', { method: 'PUT' })
|
||||
likes.value = data
|
||||
}
|
||||
|
||||
const views = ref(post.value!.views)
|
||||
const view = async () => {
|
||||
const { data } = await useFetch('/api/view', { method: 'PUT' })
|
||||
likes.value = data
|
||||
}
|
||||
|
||||
return {
|
||||
post,
|
||||
like,
|
||||
view,
|
||||
refreshPost,
|
||||
likes: computed(() => likes.value),
|
||||
views: computed(() => views.value),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user