Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄瑜
VueElementTemplate
Commits
021a7009
Commit
021a7009
authored
May 02, 2017
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine
parent
3063d9c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
README.md
README.md
+2
-2
fetch.js
src/utils/fetch.js
+3
-4
No files found.
README.md
View file @
021a7009
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
# 安装依赖
# 安装依赖
npm
install
npm
install
# 建议不要用cnpm 安装有各种诡异的bug 可以通过如下操作解决npm速度慢的问题
# 建议不要用cnpm 安装有各种诡异的bug 可以通过如下操作解决npm速度慢的问题
npm
install
--registry
=
https://registry.npm.taobao.org
npm
install
--registry
=
https://registry.npm.taobao.org
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
├── build // 构建相关
├── build // 构建相关
├── config // 配置相关
├── config // 配置相关
├── src // 源代码
├── src // 源代码
│ ├── api // 所
以
请求
│ ├── api // 所
有
请求
│ ├── assets // 主题 字体等静态资源
│ ├── assets // 主题 字体等静态资源
│ ├── components // 全局公用组件
│ ├── components // 全局公用组件
│ ├── directive // 全局指令
│ ├── directive // 全局指令
...
...
src/utils/fetch.js
View file @
021a7009
...
@@ -7,7 +7,7 @@ export default function _fetch(options) {
...
@@ -7,7 +7,7 @@ export default function _fetch(options) {
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
instance
=
axios
.
create
({
const
instance
=
axios
.
create
({
baseURL
:
process
.
env
.
BASE_API
,
baseURL
:
process
.
env
.
BASE_API
,
// timeout: 2000,
// timeout: 2000,
headers
:
{
'X-Ivanka-Token'
:
store
.
getters
.
token
}
headers
:
{
'X-Ivanka-Token'
:
store
.
getters
.
token
}
});
});
instance
(
options
)
instance
(
options
)
...
@@ -20,15 +20,14 @@ export default function _fetch(options) {
...
@@ -20,15 +20,14 @@ export default function _fetch(options) {
type
:
'error'
,
type
:
'error'
,
duration
:
5
*
1000
duration
:
5
*
1000
});
});
// 50014:Token 过期了 50012:其他客户端登录了 50008:非法的token
// 50014:Token 过期了 50012:其他客户端登录了 50008:非法的token
if
(
res
.
code
===
50008
||
res
.
code
===
50014
||
res
.
code
===
50012
)
{
if
(
res
.
code
===
50008
||
res
.
code
===
50014
||
res
.
code
===
50012
)
{
Message
({
Message
({
message
:
res
.
message
,
message
:
res
.
message
,
type
:
'error'
,
type
:
'error'
,
duration
:
5
*
1000
duration
:
5
*
1000
});
});
// router.push({path: '/'})
// 登出
// TODO
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
router
.
push
({
path
:
'/login'
})
router
.
push
({
path
:
'/login'
})
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment