Working on oauth

This commit is contained in:
2023-12-10 00:25:57 +01:00
parent ce84fa376b
commit 7fe980e478
13 changed files with 190 additions and 85 deletions

View File

@@ -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),
}
}