korean-dummy-json-fetcher
Version:
한국어 더미 데이터 생성 라이브러리
39 lines (38 loc) • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPost = getPost;
exports.getPosts = getPosts;
exports.createPost = createPost;
exports.patchPost = patchPost;
exports.putPost = putPost;
exports.deletePost = deletePost;
const api_1 = require("./api.js");
async function getPost({ id, }) {
return (0, api_1.fetcher)(`/posts/${id}`);
}
async function getPosts(options) {
return (0, api_1.fetcher)("/posts", { params: options });
}
async function createPost(data) {
return (0, api_1.fetcher)("/posts", {
method: "POST",
body: data,
});
}
async function patchPost(id, data) {
return (0, api_1.fetcher)(`/posts/${id}`, {
method: "PATCH",
body: data,
});
}
async function putPost(id, data) {
return (0, api_1.fetcher)(`/posts/${id}`, {
method: "PUT",
body: data,
});
}
async function deletePost({ id }) {
return (0, api_1.fetcher)(`/posts/${id}`, {
method: "DELETE",
});
}