Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
pro-blocks
Commits
10e8c035
Commit
10e8c035
authored
Nov 03, 2017
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix API fetch error, close #82
parent
874afcc3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
22 deletions
+20
-22
src/models/activities.js
src/models/activities.js
+1
-1
src/models/list.js
src/models/list.js
+1
-1
src/models/project.js
src/models/project.js
+1
-1
src/utils/request.js
src/utils/request.js
+17
-19
No files found.
src/models/activities.js
View file @
10e8c035
...
...
@@ -17,7 +17,7 @@ export default {
const
response
=
yield
call
(
queryActivities
);
yield
put
({
type
:
'
saveList
'
,
payload
:
response
,
payload
:
Array
.
isArray
(
response
)
?
response
:
[]
,
});
yield
put
({
type
:
'
changeLoading
'
,
...
...
src/models/list.js
View file @
10e8c035
...
...
@@ -17,7 +17,7 @@ export default {
const
response
=
yield
call
(
queryFakeList
,
payload
);
yield
put
({
type
:
'
save
'
,
payload
:
response
,
payload
:
Array
.
isArray
(
response
)
?
response
:
[]
,
});
yield
put
({
type
:
'
changeLoading
'
,
...
...
src/models/project.js
View file @
10e8c035
...
...
@@ -17,7 +17,7 @@ export default {
const
response
=
yield
call
(
queryProjectNotice
);
yield
put
({
type
:
'
saveNotice
'
,
payload
:
response
,
payload
:
Array
.
isArray
(
response
)
?
response
:
[]
,
});
yield
put
({
type
:
'
changeLoading
'
,
...
...
src/utils/request.js
View file @
10e8c035
...
...
@@ -5,24 +5,9 @@ function checkStatus(response) {
if
(
response
.
status
>=
200
&&
response
.
status
<
300
)
{
return
response
;
}
return
response
.
json
().
then
((
result
)
=>
{
if
(
result
.
code
)
{
notification
.
error
({
message
:
result
.
name
,
description
:
result
.
message
,
});
}
if
(
result
.
stack
)
{
notification
.
error
({
message
:
'
请求错误
'
,
description
:
result
.
message
,
});
}
const
error
=
new
Error
(
result
.
message
);
error
.
response
=
response
;
throw
error
;
});
const
error
=
new
Error
(
response
.
statusText
);
error
.
response
=
response
;
throw
error
;
}
/**
...
...
@@ -49,5 +34,18 @@ export default function request(url, options) {
return
fetch
(
url
,
newOptions
)
.
then
(
checkStatus
)
.
then
(
response
=>
response
.
json
())
.
catch
(
err
=>
({
err
}));
.
catch
((
error
)
=>
{
if
(
error
.
code
)
{
notification
.
error
({
message
:
error
.
name
,
description
:
error
.
message
,
});
}
if
(
'
stack
'
in
error
&&
'
message
'
in
error
)
{
notification
.
error
({
message
:
`请求错误:
${
url
}
`
,
description
:
error
.
message
,
});
}
});
}
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