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

uf-auth

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uf-auth

统一框架登录功能插件

latest
npmnpm
Version
1.1.8
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

使用前提,必须先安装axios、vue-router插件

安装

npm i uf-auth -S

使用示例

import ufAuth form 'uf-auth';

import router from '@/router';

在main.js中,载入router

app.use(router) 

之前添加以下code;

const options = {

    router: router,    ---- 必需,vue-route

    ssoUrl: ssoUrl   ---- 可选,默认值为 "http://sso.xiamenair.com.cn"

    logout: logout    ---- 可选,处理登出的方法

}

ufAuth(options);

注解

插件包含3个部分

  • 设置通用axios设置方法: ufAuth(options)

    options = {

     baseUrl: baseUrl,    ---- 必需,输入接口使用的基础域名,例如: 'http://localhost:8001'
    
     router: router,    ---- 必需,vue-route
    
     ssoUrl: ssoUrl   ---- 可选,默认值为 "http://sso.xiamenair.com.cn"
    
     logout: logout    ---- 可选,处理登出的方法
    

    }

logout默认方法:

function logout() {

    window.localStorage.removeItem('Authorization');

    router.push({ path: "/login" });

}

FAQs

Package last updated on 21 Jun 2022

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