1.0.8 • Published 12 months ago

msb-fetch v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

msb-fectch

Example code

use

import MsbFetch from "msb-fetch";

 let data1 = await MsbFetch.get(`your url`);
        console.log(data1);

        let data2=await MsbFetch.post('your url', { params1: 'params1' });


        MsbFetch.post('your url', { params1: 'params1' }).then((data) => {
            console.log(data);
        })

        const fd = new FormData();
        fd.append('params1', 'params1');
        MsbFetch.post('your url', fd, {
            headers: {
                "Content-Type": "application/x-www-form-urlencoded",
            },
        }).then((data) => {
            console.log(data);
        })


 const request=await MsbFetch.multipleGet(['url1','url2','url2'])
        const request2 = await MsbFetch.multipleRequest([{ url: 'uri1', method: 'GET',body:{} },{ url: 'url2', method: 'GET',body:{params:'params'} }]);


 const onUploadProgress = (progress: number) => {
        console.log(`Upload Progress: ${progress}%`);
    };

const fd=new FormData();
fd.append('key','value');
// add FormData

const request = await MsbFetch.post('your url', fd, { onUploadProgress: onUploadProgress });


      const onUploadKeyProgress = (progressMap: ProgressMap[]) => {
        console.log(progressMap)

    }

    const fd=new FormData();
fd.append('key','value');
// add FormData

const request = await MsbFetch.manyFileUpload('http://127.0.0.1:8000/api/uploads', fd, { onUploadKeyProgress: onUploadKeyProgress });

npm Install

npm i msb-fetch

yarn Install

yarn add msb-fetch
1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago