0.0.1-security • Published 3 years ago

fetch-xd v0.0.1-security

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Handle data with fetch method

You can see more example at this

import { get, post, put, del } from 'fetch-xd';
// Get method
// type
type TPerson = {
  userId: number;
  id: number;
  body: string;
  title: string;
};

get<TPerson[]>("https://jsonplaceholder.typicode.com/posts").then(
    ({ data }) => {
    console.log(data);
    }
);

// Post
const { data } = await post<{ id: number }>(
   "https://jsonplaceholder.typicode.com/posts",
   { title: "my post", body: "some content" }
);

Other methods are similar

Author: Nguyen Dung

0.0.1-security

3 years ago

1.0.1

5 years ago

1.0.0

5 years ago