vue-auto-logout
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

English | 简体中文

vue-auto-logout NPM version

Project

The vue project with login function will be automatically logged out of the system if it has not been operated for a long time.The conditions are as follows:

  1. The Vue project of the Web on the PC side
  2. The system has a permission mechanism related to the login function
  3. The login identifiers such as token are stored in the browser arbitrary cache

Install

$ npm install vue-auto-logout
or
$ yarn add vue-auto-logout -S

Usage

main.js:

import { createApp } from 'vue'
import App from './app'
import logoutPlugin from 'vue-auto-logout'

const app = createApp(App)
const logoutOptions = {
  stagnateTime: 30 * 60 * 1000,
  detectTime: 30 * 60
}
app.use(logoutPlugin, logoutOptions)
app.mount('#app')

Logout Options

key description default options
enable Turn on automatic logout true Boolean
keyName The key name of the token in the cache token String
clearAll Whether to clear all cached values ​​under this site true Boolean
stagnateTime No operation dead time 30min Number
detectTime How many seconds to check whether to log out 10s Number

Readme

Keywords

Package Sidebar

Install

npm i vue-auto-logout

Weekly Downloads

10

Version

1.0.1

License

MIT

Unpacked Size

59.4 kB

Total Files

19

Last publish

Collaborators

  • zeffonwu