support guard price

This commit is contained in:
2024-03-24 10:30:04 +08:00
parent f71420511f
commit 2c6bf5beac
9 changed files with 376 additions and 62 deletions

View File

@@ -85,16 +85,18 @@ export interface ForumTopicBaseModel {
isLocked?: boolean // Assuming the default value is handled elsewhere
isPinned?: boolean // Assuming the default value is handled elsewhere
isHighlighted?: boolean // Assuming the default value is handled elsewhere
isDeleted?: boolean // Assuming the default value is handled elsewhere
}
export interface ForumTopicModel extends ForumTopicBaseModel {
isLocked?: boolean // Assuming the default value is handled elsewhere
isDeleted?: boolean // Assuming the default value is handled elsewhere
isHidden?: boolean // Assuming the default value is handled elsewhere
type?: ForumTopicTypes // Assuming the default value is handled elsewhere
extraTypeId?: number | null // Nullable int in C# is optional or null in TS
likedBy?: number[] // Assuming the default value is handled elsewhere
isAdmin: boolean
}
export interface ForumCommentModel {
id: number
@@ -105,6 +107,8 @@ export interface ForumCommentModel {
likeCount: number
isLiked: boolean
isDeleted: boolean
}
export interface ForumReplyModel {
id: number

View File

@@ -2,7 +2,7 @@ import { QueryGetAPI } from '@/api/query'
import { USER_API_URL, apiFail } from '@/data/constants'
import { ref } from 'vue'
import { useRoute } from 'vue-router'
import { APIRoot, UserInfo } from './api-models'
import { APIRoot, UserBasicInfo, UserInfo } from './api-models'
export const USERS = ref<{ [id: string]: UserInfo }>({})
@@ -38,6 +38,10 @@ export async function useUserWithUId(id: number) {
}
return USERS.value[id.toString()]
}
export async function getUserBasicInfo(id: string | number | undefined) {
if (!id) return undefined
return (await QueryGetAPI<UserBasicInfo>(`${USER_API_URL}basic/${id}`)).data
}
export async function GetInfo(id: string): Promise<APIRoot<UserInfo>> {
return QueryGetAPI<UserInfo>(`${USER_API_URL}info`, {