Modify login process

This commit is contained in:
simple321vip
2022-08-28 12:45:49 +08:00
parent e9c8cb9d33
commit c865fd1184
51 changed files with 207 additions and 162 deletions
+6 -1
View File
@@ -1,5 +1,5 @@
import axios from 'axios'
import { getToken } from '../utils/auth'
import { getToken, getTenant } from '../utils/auth'
const service = axios.create(
{
@@ -13,6 +13,11 @@ service.interceptors.request.use(
if (typeof getToken() === 'string') {
(config as any).headers['Authorization'] = 'Bearer' + getToken()
}
const tenant = getTenant()
if (typeof tenant === 'string') {
(config as any).headers['id'] = JSON.parse(tenant).id
}
return config
},
error => {