Skip to content

Commit 039f923

Browse files
author
Vikas Agarwal
committed
Handling non 404 more appropriately. Now it should not show maintenance page for 403 or any custom status returned by the API, it should be shown only if the API endpoint does not exist.
1 parent ecf3fd5 commit 039f923

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/components/Layout/Layout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Layout extends Component {
1919
}
2020

2121
const mapStateToProps = ({ loadUser, projectState, projectSearch }) => {
22-
const projectDetailApiCheck = !projectState.isLoading && !!projectState.error
22+
const projectDetailApiCheck = !projectState.isLoading && !!projectState.error && projectState.error.code === 404
2323
const projectListingApiCheck = !projectSearch.isLoading && !!projectSearch.error
2424
return {
2525
user : loadUser.user,

src/projects/reducers/project.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ const initialState = {
2929

3030
const parseErrorObj = (action) => {
3131
const data = _.get(action.payload, 'response.data.result')
32+
const httpStatus = _.get(action.payload, 'response.status')
3233
return {
3334
type: action.type,
34-
code: _.get(data, 'status', 500),
35+
code: _.get(data, 'status', httpStatus || 500),
3536
msg: _.get(data, 'content.message', ''),
3637
details: JSON.parse(_.get(data, 'details', null))
3738
}

0 commit comments

Comments
 (0)