31 lines
757 B
TypeScript
31 lines
757 B
TypeScript
import request from '@/utils/request.ts'
|
|
|
|
/**
|
|
* 文件上传 API
|
|
*/
|
|
export const uploadApi = {
|
|
/**
|
|
* 上传图片
|
|
*/
|
|
uploadImage(file: File, onProgress?: (percent: number) => void): Promise<string> {
|
|
return request.upload('/user/profile/avatar', file, onProgress)
|
|
},
|
|
|
|
/**
|
|
* 上传视频
|
|
*/
|
|
uploadVideo(file: File, onProgress?: (percent: number) => void): Promise<{ videoUrl: string; coverUrl: string }> {
|
|
return request.upload('/content/video/upload', file, onProgress)
|
|
}
|
|
}
|
|
|
|
// 导出所有 API
|
|
export * from './auth.ts'
|
|
export * from './user.ts'
|
|
export * from './video.ts'
|
|
export * from './comment.ts'
|
|
export * from './category.ts'
|
|
export * from './danmaku.ts'
|
|
export * from './favorite.ts'
|
|
export * from './recommend.ts'
|