32 lines
819 B
TypeScript
32 lines
819 B
TypeScript
import { client } from "@/shared/api";
|
|
import { ENDPOINT } from "@/shared/config";
|
|
import type { PageableList } from "@/shared/model";
|
|
import type {
|
|
PostService,
|
|
PostingParams,
|
|
Post,
|
|
PostPayloadData,
|
|
} from "../model/posting-interface";
|
|
|
|
export class PostingApiService implements PostService {
|
|
public async getPostingHistory(
|
|
params: PostingParams,
|
|
): Promise<PageableList<Post>> {
|
|
const response = await client.get<PageableList<Post>>(
|
|
`${ENDPOINT.CMS_SERVICE.POSTINGS}`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async savePosting(data: PostPayloadData[]): Promise<Post[]> {
|
|
const response = await client.post<Post[]>(
|
|
`${ENDPOINT.CMS_SERVICE.POSTINGS}`,
|
|
data,
|
|
);
|
|
return response.data;
|
|
}
|
|
}
|
|
|
|
export const PostingApi = new PostingApiService();
|