1.2.1172022 • Published 2 years ago

@myzero1/z1-token-guard-client v1.2.1172022

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@myzero1/z1-token-guard-client

z1-token-guard-client

Use it

require z1-token-guard-server

The download address will be provided later

jquery Browser

<script src="https://cdn.jsdelivr.net/npm/@myzero1/z1-token-guard-client@1.0.4"></script>
<script>
    // It only needs to be executed once in a page
    z1TokenGuardClient.z1client.z1TokenGuardClientInit("http://localhost:8080");

    // It is recommended that the target request occur after obtaining rtoken
    (async function () {
        var rt = await z1TokenGuardClient.z1client.z1TokenGuardClientGetRtoken();
        console.log('z1TokenGuardClientGetRtoken is ok,will send real request')
        const resp = await fetch("http://localhost:8080/token-test?rt="+rt);
        const data = await resp.text();
        console.log(data)
    })();
</script>

z1-token-guard-server download url

https://gitee.com/myzero1/z1-token-guard/releases

Vue Browser

> npm i @myzero1/z1-token-guard-client
const z1TokenGuardClient = require("@myzero1/z1-token-guard-client")

// It only needs to be executed once in a page
z1TokenGuardClient.z1client.z1TokenGuardClientInit("http://localhost:8080");

// It is recommended that the target request occur after obtaining rtoken
(async function () {
    var rt = await z1TokenGuardClient.z1client.z1TokenGuardClientGetRtoken();
    console.log('z1TokenGuardClientGetRtoken is ok,will send real request')
    const resp = await fetch("http://localhost:8080/token-test?rt="+rt);
    const data = await resp.text();
    console.log(data)
})();

Features

  • Use next javascript development.
  • Run in nodejs and browser.
  • Built-in bundle analyzer report, document generation, lint, unit testing && code coverage

Development Setup

You will need Node.js version 10+.

After cloning the repo, run:

# Installation dependency
$ npm install

# build for production with minification
$ npm run build

# build for production and generate the bundle analyzer report
$ npm run analyse

# Generate document.
$ npm run ts-doc

There are some other scripts available in the scripts section of the package.json file.