完成JC-ArtList与JC-Salon端侧清理和统一命名
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Front-end API wrapper for this module.
|
||||
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
|
||||
*/
|
||||
import api from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
/**
|
||||
* productLikeApi groups all API calls for this page domain.
|
||||
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
||||
*/
|
||||
export const productLikeApi = {
|
||||
/**
|
||||
* 点赞作品
|
||||
* @param productId 作品ID
|
||||
*/
|
||||
/**
|
||||
* `likeProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param productId: IdType caller-supplied value for `productId: IdType`
|
||||
*/
|
||||
likeProduct: (productId: IdType) => {
|
||||
return api.post<boolean>(`/product-like/like/${productId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 取消点赞作品
|
||||
* @param productId 作品ID
|
||||
*/
|
||||
/**
|
||||
* `unlikeProduct` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param productId: IdType caller-supplied value for `productId: IdType`
|
||||
*/
|
||||
unlikeProduct: (productId: IdType) => {
|
||||
return api.post<boolean>(`/product-like/unlike/${productId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 检查用户是否已点赞作品
|
||||
* @param productId 作品ID
|
||||
*/
|
||||
/**
|
||||
* `checkLikeStatus` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param productId: IdType caller-supplied value for `productId: IdType`
|
||||
*/
|
||||
checkLikeStatus: (productId: IdType) => {
|
||||
return api.get<boolean>(`/product-like/check/${productId}`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user