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
A
ant-design-pro
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
ant-design-pro
Commits
303c5e43
Unverified
Commit
303c5e43
authored
Mar 19, 2018
by
niko
Committed by
GitHub
Mar 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Error Trigger dump code & support static env (#1128)
* remove dump code * compatibility for static
parent
603bcd7c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
70 deletions
+19
-70
src/models/error.js
src/models/error.js
+7
-25
src/routes/Exception/triggerException.js
src/routes/Exception/triggerException.js
+10
-31
src/services/error.js
src/services/error.js
+2
-14
No files found.
src/models/error.js
View file @
303c5e43
import
{
query403
,
query401
,
query404
,
query500
}
from
'
../services/error
'
;
import
{
routerRedux
}
from
'
dva/router
'
;
import
{
query
}
from
'
../services/error
'
;
export
default
{
namespace
:
'
error
'
,
...
...
@@ -9,32 +10,13 @@ export default {
},
effects
:
{
*
query403
(
_
,
{
call
,
put
})
{
yield
call
(
query403
);
*
query
({
payload
},
{
call
,
put
})
{
yield
call
(
query
,
payload
.
code
);
// redirect on client when network broken
yield
put
(
routerRedux
.
push
(
`/exception/
${
payload
.
code
}
`
));
yield
put
({
type
:
'
trigger
'
,
payload
:
'
403
'
,
});
},
*
query401
(
_
,
{
call
,
put
})
{
yield
call
(
query401
);
yield
put
({
type
:
'
trigger
'
,
payload
:
'
401
'
,
});
},
*
query500
(
_
,
{
call
,
put
})
{
yield
call
(
query500
);
yield
put
({
type
:
'
trigger
'
,
payload
:
'
500
'
,
});
},
*
query404
(
_
,
{
call
,
put
})
{
yield
call
(
query404
);
yield
put
({
type
:
'
trigger
'
,
payload
:
'
404
'
,
payload
:
payload
.
code
,
});
},
},
...
...
src/routes/Exception/triggerException.js
View file @
303c5e43
...
...
@@ -7,55 +7,34 @@ import styles from './style.less';
isloading
:
state
.
error
.
isloading
,
}))
export
default
class
TriggerException
extends
PureComponent
{
state
=
{
state
=
{
isloading
:
false
,
}
trigger401
=
()
=>
{
this
.
setState
({
isloading
:
true
,
});
this
.
props
.
dispatch
({
type
:
'
error/query401
'
,
});
};
trigger403
=
()
=>
{
this
.
setState
({
isloading
:
true
,
});
this
.
props
.
dispatch
({
type
:
'
error/query403
'
,
});
};
trigger500
=
()
=>
{
this
.
setState
({
isloading
:
true
,
});
this
.
props
.
dispatch
({
type
:
'
error/query500
'
,
});
};
trigger
404
=
(
)
=>
{
trigger
Error
=
(
code
)
=>
{
this
.
setState
({
isloading
:
true
,
});
this
.
props
.
dispatch
({
type
:
'
error/query404
'
,
type
:
'
error/query
'
,
payload
:
{
code
,
},
});
};
render
()
{
return
(
<
Card
>
<
Spin
spinning
=
{
this
.
state
.
isloading
}
wrapperClassName
=
{
styles
.
trigger
}
>
<
Button
type
=
"
danger
"
onClick
=
{
this
.
trigger401
}
>
<
Button
type
=
"
danger
"
onClick
=
{
()
=>
this
.
triggerError
(
401
)
}
>
触发401
<
/Button
>
<
Button
type
=
"
danger
"
onClick
=
{
this
.
trigger403
}
>
<
Button
type
=
"
danger
"
onClick
=
{
()
=>
this
.
triggerError
(
403
)
}
>
触发403
<
/Button
>
<
Button
type
=
"
danger
"
onClick
=
{
this
.
trigger500
}
>
<
Button
type
=
"
danger
"
onClick
=
{
()
=>
this
.
triggerError
(
500
)
}
>
触发500
<
/Button
>
<
Button
type
=
"
danger
"
onClick
=
{
this
.
trigger404
}
>
<
Button
type
=
"
danger
"
onClick
=
{
()
=>
this
.
triggerError
(
404
)
}
>
触发404
<
/Button
>
<
/Spin
>
...
...
src/services/error.js
View file @
303c5e43
import
request
from
'
../utils/request
'
;
export
async
function
query404
()
{
return
request
(
'
/api/404
'
);
}
export
async
function
query401
()
{
return
request
(
'
/api/401
'
);
}
export
async
function
query403
()
{
return
request
(
'
/api/403
'
);
}
export
async
function
query500
()
{
return
request
(
'
/api/500
'
);
export
async
function
query
(
code
)
{
return
request
(
`/api/
${
code
}
`
);
}
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