import { GET , POST , PUT } from '@/utils/fetch' ; import { IPost } from '@cc98/api' ; /**
 * 获取帖子内容
 */ export async function getOriginalPost ( postId ) { return GET < IPost > ( `post/${ postId }/original` ) ; } /**
 * 上传图片
 */ export async function uploadPicture ( file ) { const formData = new FormData ( ) ; formData . append ( 'files' , file , file . name ) ; return POST < string > ( 'file' , { headers : { } , requestInit : { body : formData , } , } ) ; } export interface IPostParams { /**
     * 标题
     */ title : string ; /**
     * 回帖内容
     */ content : string ; /**
     * 回帖格式
     */ contentType : 0 | 1 ; } export interface ITopicParams extends IPostParams { /**
     * 帖子类型
     */ type : number ; /**
     * tags
     */ tag1 ? : number ; tag2 ? : number ; } /**
 * 发帖
 */ export async function postTopic ( boardId , topicParams ) { return POST ( `board/${ boardId }/topic` , { params : topicParams , } ) ; } /**
 * 回帖
 */ export async function replyTopic ( topicId , postParams ) { return POST ( `topic/${ topicId }/post` , { params : postParams , } ) ; } /**
 * 编辑帖子
 */ export async function editorPost ( topicId , params ) { return PUT ( `post/${ topicId }` , { params , } ) ; }