UNPKG

korean-dummy-json-fetcher

Version:

한국어 더미 데이터 생성 라이브러리

31 lines (30 loc) 720 B
import { fetcher } from "./api.js"; export async function getPost({ id, }) { return fetcher(`/posts/${id}`); } export async function getPosts(options) { return fetcher("/posts", { params: options }); } export async function createPost(data) { return fetcher("/posts", { method: "POST", body: data, }); } export async function patchPost(id, data) { return fetcher(`/posts/${id}`, { method: "PATCH", body: data, }); } export async function putPost(id, data) { return fetcher(`/posts/${id}`, { method: "PUT", body: data, }); } export async function deletePost({ id }) { return fetcher(`/posts/${id}`, { method: "DELETE", }); }