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

View file

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

View file

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

View file

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