feat(client-side): add function to update view count to clientside
This commit is contained in:
parent
8a47da4e67
commit
eab4d5eb8b
3
lib/client/science.ts
Normal file
3
lib/client/science.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export const recordView = async (sid: number) => {
|
||||
await useApiFetch(`/story/${sid}/set-viewed`);
|
||||
};
|
@ -6,6 +6,7 @@
|
||||
import storyInfo from "~/components/story/view/storyInfo.vue";
|
||||
import chapterPicker from "~/components/story/view/chapterPicker.vue";
|
||||
import { IUser } from "@models/user";
|
||||
import { recordView } from "@client/science";
|
||||
|
||||
const { useToken } = theme;
|
||||
const { token } = useToken();
|
||||
@ -24,6 +25,7 @@
|
||||
useHead({
|
||||
title: `"${story.value.title}" by ${story.value.author.username}${and.value}`,
|
||||
});
|
||||
await recordView(story.value._id!);
|
||||
</script>
|
||||
<template>
|
||||
<a-typography-title>
|
||||
|
Loading…
Reference in New Issue
Block a user