@ecip/ecip-web
Version:
A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features
33 lines (28 loc) • 891 B
JavaScript
import { getToken, setToken } from '@/utils/auth'
import { urlSearchReWrite, getParamFromUrl, urlFormat } from 'ecip-web/utils/center-auth-utils'
import { whiteList } from '@/settings'
const _whiteList = whiteList || ['/login', '/auth-redirect', '/change-pwd', '/zlt-auth', '/center-auth'] // no redirect whitelist
/**
* 单点登录
*/
const baseUrl = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'staging' ? '' : process.env.VUE_APP_BASE_API
const init = (callback) => {
const tokenFromUrl = getParamFromUrl('token', document.location.toString())
if (tokenFromUrl) {
console.log('have token from url')
setToken(tokenFromUrl)
}
const token = getToken()
if (token) {
urlFormat()
} else {
console.log('token empty...')
}
}
function loginSuccess(callback) {
callback()
}
const CenterAuth = {
init: init
}
export default CenterAuth