Socket
Socket
Sign inDemoInstall

sbx-client-request

Package Overview
Dependencies
1
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

sbx-client-request

sbx-client-request


Version published
Maintainers
1
Weekly downloads
90
increased by83.67%

Weekly downloads

Readme

Source

SBX Request

sbx i --save sbx-request
import Request from 'sbx-request';

const getServerUrl = () => {
  let server = APP_CONFIG.connection.REST;
  return server.protocol + '://' + server.host + ':' + server.port;
};

const request = new Request({
  url: getServerUrl(), // Url to backend server,
  needAuthorization: true, // If true, check and save Authorization key, default - true,
  headers: {..yourHeaders}, // If you need to send some custome headers, default - { 'Content-Type': 'application/json' }
  commonData: {
    apiVersion: 2
  } //some common data in any request
})

export default request;
import request from 'path';
request.post({
  url: '/trade', // relative part of url
  data: {...yourObject}, // data
  needAuthorization: false, // If false Auth token will not send to server, priority over property in class instance creation,
  async: true, // default - true
})

// request methods:
// post, put, get, delete, patch
// logout - clear Auth token from both localStorage and Cookie

FAQs

Last updated on 21 Feb 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc