feat: 公共链接分享

This commit is contained in:
fit2cloud-chenyw
2021-03-26 18:44:41 +08:00
parent 89f0c5e7aa
commit ced8c21e28
27 changed files with 724 additions and 64 deletions

View File

@@ -10,6 +10,7 @@ import { tryShowLoading, tryHideLoading } from './loading'
const TokenKey = Config.TokenKey
const RefreshTokenKey = Config.RefreshTokenKey
const LinkTokenKey = Config.LinkTokenKey
// create an axios instance
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
@@ -28,6 +29,9 @@ service.interceptors.request.use(
// please modify it according to the actual situation
config.headers[TokenKey] = getToken()
}
if (store.getters.linkToken) {
config.headers[LinkTokenKey] = store.getters.linkToken
}
// 增加loading
config.loading && tryShowLoading(store.getters.currentPath)
@@ -68,6 +72,11 @@ const checkAuth = response => {
const refreshToken = response.headers[RefreshTokenKey]
store.dispatch('user/refreshToken', refreshToken)
}
if (response.headers[LinkTokenKey]) {
const linkToken = response.headers[LinkTokenKey]
store.dispatch('link/setLinkToken', linkToken)
}
}
const checkPermission = response => {