Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lesca-fetcher

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lesca-fetcher

Integrate fetch for easier use

  • 1.0.2
  • npm
  • Socket score

Version published
Weekly downloads
35
decreased by-23.91%
Maintainers
1
Weekly downloads
 
Created
Source

NPM React React React React React NPM

Integrate fetch for easier use.

Installation

npm install lesca-fetcher --save

Usage

import Fetch, { contentType, formatType } from 'lesca-fetcher';

Fetch.install({
  hostUrl: 'https://yourhost.com/api/',
  contentType: contentType.JSON,
  formatType: formatType.JSON,
});

Fetch.setJWT('Fsr.956b6.67ktJGr'); // if necessary


<button
  onClick={() => {
    const path = '/save';
    const data = { name: 'myName', age: '18' };
    Fetch.post(path, data).then((respone) => {
      // ...script
      console.log(respone);
    });
  }}
>post</div>;

<button
  onClick={() => {
    const path = '/get';
    Fetch.get(path).then((respone) => {
      // ...script
      console.log(respone);
    });
  }}
>get</div>;

Development

Methods

methoddescriptiondefault
.install(config:object)install first
.post(api:string, data:object)POST
.get(api:string)GET
.setJWT(token):stringset JWT Token
.postStringify(api:string, data:object):stringpost and stringify
config
const config = {
  hostUrl: 'https://www.yourHost.com/api/', // string
  contentType: contentType.JSON, // enum contentType.JSON || contentType.URL_ENCODED
  formatType: formatType.JSON, // enum formatType.JSON || formatType.string
};

Features

  • maintain if necessary

Keywords

FAQs

Package last updated on 10 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc