1.0.1 • Published 4 years ago

z1-token-guard-client v1.0.1

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

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="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></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>

Vue Browser

> npm i z1-token-guard-client
const z1TokenGuardClient = require("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.