diff --git a/pkg/views/src/components/comments/CommentList.vue b/pkg/views/src/components/comments/CommentList.vue index 264f8af..f56c2ef 100644 --- a/pkg/views/src/components/comments/CommentList.vue +++ b/pkg/views/src/components/comments/CommentList.vue @@ -24,7 +24,8 @@ const editor = useEditor() const props = defineProps<{ comments: any[] - model: any + model: string + dataset: string alias: any item: any }>() @@ -38,7 +39,7 @@ const pagination = reactive({ page: 0, pageSize: 10, total: 0 }) async function readComments() { loading.value = true const res = await request( - `/api/p/${props.model}/${props.alias}/comments?` + + `/api/p/${props.dataset}/${props.alias}/comments?` + new URLSearchParams({ take: pagination.pageSize.toString(), offset: (pagination.page * pagination.pageSize).toString() @@ -71,7 +72,7 @@ watch(editor, (val) => { function leaveComment() { editor.related.comment_to = props.item - editor.related.comment_to.model_type += "s" + editor.related.comment_to.model_type = props.dataset editor.show.comment = true } diff --git a/pkg/views/src/components/posts/ArticleContent.vue b/pkg/views/src/components/posts/ArticleContent.vue index 1da6aec..7bfd373 100644 --- a/pkg/views/src/components/posts/ArticleContent.vue +++ b/pkg/views/src/components/posts/ArticleContent.vue @@ -7,7 +7,7 @@
diff --git a/pkg/views/src/components/publish/ArticleEditor.vue b/pkg/views/src/components/publish/ArticleEditor.vue index 5e577ec..3e7cac9 100644 --- a/pkg/views/src/components/publish/ArticleEditor.vue +++ b/pkg/views/src/components/publish/ArticleEditor.vue @@ -126,7 +126,7 @@ async function postArticle(evt: SubmitEvent) { if (res.status === 200) { const data = await res.json() form.reset() - router.push({ name: "posts.details", params: { postType: "articles", alias: data.alias } }) + router.push({ name: "posts.details.articles", params: { alias: data.alias } }) success.value = true editor.show.article = false } else { diff --git a/pkg/views/src/router/index.ts b/pkg/views/src/router/index.ts index e518bfc..4d403da 100644 --- a/pkg/views/src/router/index.ts +++ b/pkg/views/src/router/index.ts @@ -15,9 +15,9 @@ const router = createRouter({ }, { - path: "/p/:postType/:alias", - name: "posts.details", - component: () => import("@/views/posts/details.vue") + path: "/p/articles/:alias", + name: "posts.details.articles", + component: () => import("@/views/posts/articles.vue") } ] } diff --git a/pkg/views/src/views/explore.vue b/pkg/views/src/views/explore.vue index 6cadb98..3b25288 100644 --- a/pkg/views/src/views/explore.vue +++ b/pkg/views/src/views/explore.vue @@ -7,6 +7,7 @@
+
diff --git a/pkg/views/src/views/posts/details.vue b/pkg/views/src/views/posts/articles.vue similarity index 94% rename from pkg/views/src/views/posts/details.vue rename to pkg/views/src/views/posts/articles.vue index 419d6b7..8107bac 100644 --- a/pkg/views/src/views/posts/details.vue +++ b/pkg/views/src/views/posts/articles.vue @@ -30,9 +30,10 @@
@@ -59,7 +60,7 @@ const route = useRoute() async function readPost() { loading.value = true - const res = await request(`/api/p/${route.params.postType}/${route.params.alias}`) + const res = await request(`/api/p/articles/${route.params.alias}`) if (res.status !== 200) { error.value = await res.text() } else {