成就等界面接口调整
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { api } from '@/apis/index';
|
||||
import type { UserCollection, ResultDomain } from '@/types';
|
||||
import type { UserCollection, UserCollectionVO, ResultDomain } from '@/types';
|
||||
|
||||
/**
|
||||
* 用户收藏API服务
|
||||
@@ -13,14 +13,13 @@ import type { UserCollection, ResultDomain } from '@/types';
|
||||
export const userCollectionApi = {
|
||||
baseUrl: '/usercenter/collections',
|
||||
/**
|
||||
* 获取用户收藏列表
|
||||
* 获取用户收藏列表(扁平化VO,包含资源/课程详情)
|
||||
* @param userID 用户ID
|
||||
* @param collectionType 收藏类型
|
||||
* @returns Promise<ResultDomain<UserCollection>>
|
||||
* @returns Promise<ResultDomain<UserCollectionVO>>
|
||||
*/
|
||||
async getUserCollections(userID: string, collectionType?: number): Promise<ResultDomain<UserCollection>> {
|
||||
const response = await api.get<UserCollection>(`${this.baseUrl}/list`, {
|
||||
userID,
|
||||
async getUserCollections(userID: string, collectionType?: number): Promise<ResultDomain<UserCollectionVO>> {
|
||||
const response = await api.get<UserCollectionVO>(`${this.baseUrl}/user/${userID}`, {
|
||||
collectionType
|
||||
});
|
||||
return response.data;
|
||||
@@ -43,12 +42,8 @@ export const userCollectionApi = {
|
||||
* @param collectionID 收藏对象ID
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async removeCollection(userID: string, collectionType: number, collectionID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.baseUrl}/collect`, {
|
||||
userID,
|
||||
collectionType,
|
||||
collectionID
|
||||
});
|
||||
async removeCollection(collection: UserCollection): Promise<ResultDomain<UserCollection>> {
|
||||
const response = await api.delete<UserCollection>(`${this.baseUrl}/collect`, collection);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user