New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@winm2m/web

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@winm2m/web

A package for developing webbased user service.

latest
Source
npmnpm
Version
1.2.4
Version published
Maintainers
0
Created
Source

@WinM2M/web

This package is a set of features commonly used to build web-based applications. It includes utility functions related to JWT authentication, RESTful API calls to external backend systems, and asynchronous processing. It also includes components to help you handle authentication written in Vue.

Features

  • JWT Authentication: Seamless integration for managing user authentication and token validation.
  • RESTful API Calls: Easy-to-use functions to interact with backend APIs.
  • Asynchronous Handling: Utilities for managing asynchronous operations efficiently.

Installation

To install the package, use npm:

npm install @winm2m/web

Usage Example

import { hasAuthToken, api, setAuthToken } from '@winm2m/web';

if (hasAuthToken()) {
    // Do something
}

api.updateBaseURL('https://example.com');

// request unauthorized
api.post('/api/login', { username: 'admin', password: 'admin' }).then((response) => {
    // Do something
});

// set token. authToken is stored in localStorage
setAuthToken('some token');

// then, request with token
api.get('/api/get-data').then((response) => {
    // Do something
});

// load authToken from localStorage
loadAuthToken();

// to clear authToken
clearAuthToken();

License

This project is licensed under the MIT License.

Keywords

vue3

FAQs

Package last updated on 04 Sep 2024

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