module-menu-vue 0.0.34 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -26,9 +26,8 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script >
|
|
29
|
+
import { Axios } from '../Util/axios.js'
|
|
29
30
|
import {userMenuIcon} from './constant.js'
|
|
30
|
-
import axios from 'axios';
|
|
31
|
-
import '../Util/axios.js'
|
|
32
31
|
export default {
|
|
33
32
|
name: 'UserInfo',
|
|
34
33
|
data () {
|
|
@@ -60,15 +59,9 @@ export default {
|
|
|
60
59
|
},
|
|
61
60
|
logoutFunc () {
|
|
62
61
|
console.log('开始调用退出接口...')
|
|
63
|
-
|
|
64
|
-
// 退出登录
|
|
65
|
-
httpDefult = {
|
|
66
|
-
method: 'delete',
|
|
67
|
-
url: '/auth/token/logout',
|
|
68
|
-
};
|
|
69
|
-
axios(httpDefult)
|
|
62
|
+
Axios('delete', '/auth/token/logout')
|
|
70
63
|
.then((res) => {
|
|
71
|
-
|
|
64
|
+
console.log('res: ', res)
|
|
72
65
|
localStorage.clear();
|
|
73
66
|
sessionStorage.clear();
|
|
74
67
|
location.href = '/#/login';
|
|
@@ -2,7 +2,6 @@ import axios from 'axios';
|
|
|
2
2
|
import { getStore } from './userInfo.js';
|
|
3
3
|
import { checkToken } from './permessionUtils';
|
|
4
4
|
let tokenValue = '574536b1-5832-417b-b909-82e204679d67';
|
|
5
|
-
|
|
6
5
|
axios.interceptors.response.use(
|
|
7
6
|
(response) => {
|
|
8
7
|
if (response.status === 200) {
|
|
@@ -61,12 +60,33 @@ axios.interceptors.request.use(
|
|
|
61
60
|
params.headers['Authorization'] = `Bearer ${tokenValue}`;
|
|
62
61
|
params.headers['TENANT-ID'] = '1';
|
|
63
62
|
}
|
|
64
|
-
console.log('
|
|
65
|
-
console.log('params1', JSON.stringify(params))
|
|
63
|
+
console.log('params', JSON.stringify(params))
|
|
66
64
|
return params;
|
|
67
65
|
},
|
|
68
66
|
function (error) {
|
|
69
67
|
// 对请求错误做些什么
|
|
70
68
|
return Promise.reject(error);
|
|
71
69
|
},
|
|
72
|
-
);
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
function Axios(method, url) {
|
|
73
|
+
|
|
74
|
+
let httpDefult = {
|
|
75
|
+
method,
|
|
76
|
+
url,
|
|
77
|
+
};
|
|
78
|
+
console.log('httpDefult', httpDefult)
|
|
79
|
+
return new Promise((resolve, reject) => {
|
|
80
|
+
axios(httpDefult)
|
|
81
|
+
.then((res) => {
|
|
82
|
+
console.log('res', res)
|
|
83
|
+
resolve(res);
|
|
84
|
+
})
|
|
85
|
+
.catch((err) => {
|
|
86
|
+
console.log('err', err)
|
|
87
|
+
reject(err);
|
|
88
|
+
});
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default Axios;
|