Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
b3aeddbd
authored
2023-06-13 16:47:42 +0800
by
renchao@pashanhoo.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:cas
1 parent
bc7b3afe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
11 deletions
src/permission.js
src/utils/request.js
src/permission.js
View file @
b3aeddb
/*
* @Description: 项目权限
* @Autor: renchao
* @LastEditTime: 2023-06-13 16:
28:25
* @LastEditTime: 2023-06-13 16:
35:40
*/
import
Vue
from
'vue'
import
axios
from
'axios'
...
...
@@ -46,7 +46,7 @@ router.beforeEach(async (to, from, next) => {
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
localStorage
.
setItem
(
'token'
,
res
.
data
.
content
.
accessToken
)
}
else
{
Cookies
.
set
(
'ACCESS_TOKEN'
,
res
.
data
.
content
.
accessToken
)
Cookies
.
set
(
"ACCESS_TOKEN"
,
res
.
data
.
content
.
accessToken
);
}
window
.
location
.
href
=
localStorage
.
getItem
(
'location'
)
...
...
src/utils/request.js
View file @
b3aeddb
...
...
@@ -2,7 +2,7 @@
/*
* @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
* @Autor: renchao
* @LastEditTime: 2023-06-13 16:
28:57
* @LastEditTime: 2023-06-13 16:
37:19
*/
import
axios
from
'axios'
import
Router
from
'@/router'
...
...
@@ -34,14 +34,6 @@ service.interceptors.request.use(
}
else
{
config
.
headers
.
delete
(
'Authorization'
)
}
}
else
{
const
token
=
Cookies
.
get
(
'ACCESS_TOKEN'
)
// 添加请求头
if
(
token
)
{
config
.
headers
[
'Authorization'
]
=
'Bearer '
+
token
}
else
{
config
.
headers
.
delete
(
'Authorization'
)
}
}
return
config
},
...
...
Please
register
or
sign in
to post a comment