功能:完善门店能力与用户安全配置
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* 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'
|
||||
|
||||
@@ -18,13 +22,32 @@ export interface CommentVO {
|
||||
replies?: CommentVO[]
|
||||
}
|
||||
|
||||
/**
|
||||
* commentApi 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 commentApi = {
|
||||
/**
|
||||
* `listByProduct` 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`
|
||||
*/
|
||||
listByProduct: (productId: IdType) => {
|
||||
return api.get<CommentVO[]>(`/comment/list/product/${productId}`) as unknown as Promise<CommentVO[]>
|
||||
},
|
||||
/**
|
||||
* `create` 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 data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string } caller-supplied value for `data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }`
|
||||
*/
|
||||
create: (data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }) => {
|
||||
return api.post<IdType>('/comment/create', data) as unknown as Promise<IdType>
|
||||
},
|
||||
/**
|
||||
* `delete` 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 id: IdType caller-supplied value for `id: IdType`
|
||||
*/
|
||||
delete: (id: IdType) => {
|
||||
return api.delete<boolean>(`/comment/delete/${id}`) as unknown as Promise<boolean>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user