Files
frontend/apps/common/features/src/entities/post/api/post-service.ts
T

31 lines
866 B
TypeScript

import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type {
PostInfo,
PostList,
PostParams,
PostService,
} from "../model/post-interface";
export class PostApiService implements PostService {
public async getPostList(params: PostParams): Promise<PostList> {
const response = await client.get<PostList>(ENDPOINT.BOARD_SERVICE.POSTS, {
params,
});
return response.data;
}
public async getPostInfo(bbsId: string, pstNo: string): Promise<PostInfo> {
const response = await client.get<PostInfo>(
`${ENDPOINT.BOARD_SERVICE.POSTS}/${bbsId}/${pstNo}`,
);
return response.data;
}
public async deletePost(bbsId: string, pstNo: string): Promise<void> {
await client.delete(`${ENDPOINT.BOARD_SERVICE.POSTS}/${bbsId}/${pstNo}`);
}
}
export const PostApi = new PostApiService();