BUG fix: NaN

This commit is contained in:
KUN1007 2023-12-02 15:17:19 +08:00
parent 19ac674874
commit dfa07a4c5a
4 changed files with 7 additions and 10 deletions

View file

@ -4,7 +4,7 @@ import objectToQueryParams from '@/utils/objectToQueryParams'
import * as Reply from './types/reply'
// Get topic replies by tid
export async function getRepliesByPidApi(
export async function getRepliesByTidApi(
request: Reply.TopicReplyRequestData
): Promise<Reply.TopicReplyResponseData> {
const queryParams = objectToQueryParams(request, 'tid')
@ -16,7 +16,7 @@ export async function getRepliesByPidApi(
}
// Create a reply by tid
export async function postReplyByPidApi(
export async function postReplyByTidApi(
request: Reply.TopicCreateReplyRequestData
): Promise<Reply.TopicCreateReplyResponseData> {
const url = `/topics/${request.tid}/reply`

View file

@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
import { postReplyByPidApi } from '@/api'
import { postReplyByTidApi } from '@/api'
import type {
TopicCreateReplyRequestData,
@ -48,7 +48,7 @@ export const usePersistKUNGalgameReplyStore = defineStore({
return
}
return await postReplyByPidApi(requestData)
return await postReplyByTidApi(requestData)
},
// Reset reply draft to its original value, used for the reply publish button

View file

@ -1,7 +1,7 @@
import { defineStore } from 'pinia'
import {
getRepliesByPidApi,
getRepliesByTidApi,
updateReplyUpvoteApi,
updateReplyLikeApi,
updateReplyDislikeApi,
@ -91,7 +91,7 @@ export const useTempReplyStore = defineStore({
sortField: this.replyRequest.sortField || 'floor',
sortOrder: this.replyRequest.sortOrder || 'desc',
}
return await getRepliesByPidApi(requestData)
return await getRepliesByTidApi(requestData)
},
// Upvote a reply

View file

@ -1,4 +1,3 @@
<!-- KUNGalgame topic page -->
<script setup lang="ts">
import {
onMounted,
@ -49,9 +48,7 @@ const {
const { isShowCommentPanelRid } = storeToRefs(useTempCommentStore())
const tid = computed(() => {
return parseInt(route.params.tid as string)
})
const tid = ref(parseInt(route.params.tid as string))
const topicData = ref<TopicDetail>()
const repliesData = ref<TopicReply[]>([])