yg-auth-docking
1.0.8 • Public • Published yg-auth-docking
实现与yg-auth
的对接
npm install yg-auth-docking
import YGAD from 'yg-auth-docking'
const ygad = new YGAD({
BASEURL: '',
ASSET_BASEURL: '',
DEFAULT_HEAD: '',
LOGIN_URL: '',
TOKEN_NAME: '',
QUERY_PARAM: '',
USER_TAG: ''
})
ygad.checkLogin().then(rs => {
if (rs && rs.stuid) {
} else {
ygad.gotoLogin()
}
}).catch(() => {
setTimeout(() => {
ygad.gotoLogin()
}, 2000)
})
ygad.getStorage(ygad.config.USER_TAG)
ygad.getStorage(ygad.config.TOKEN_NAME)
ygad.rmStorage(ygad.config.USER_TAG)
ygad.rmStorage(ygad.config.TOKEN_NAME)
const token = ygad.getQueryString('token') || ygad.getStorage(ygad.config.TOKEN_NAME) || ''
ygad.getUserInfor(token).then(e => {
})
Package Sidebar
Install
Weekly Downloads