Skip to content

Commit 73f2d30

Browse files
author
vikasrohit
authored
Merge pull request #2084 from appirio-tech/hotfix/maintenance_mode_enablement_master
Hotfix/maintenance mode enablement master
2 parents 9854422 + 039f923 commit 73f2d30

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/components/Layout/Layout.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ class Layout extends Component {
1818
}
1919
}
2020

21-
const mapStateToProps = ({ loadUser }) => {
21+
const mapStateToProps = ({ loadUser, projectState, projectSearch }) => {
22+
const projectDetailApiCheck = !projectState.isLoading && !!projectState.error && projectState.error.code === 404
23+
const projectListingApiCheck = !projectSearch.isLoading && !!projectSearch.error
2224
return {
2325
user : loadUser.user,
24-
isLoadingUser: loadUser.isLoading
26+
isLoadingUser: loadUser.isLoading,
27+
maintenanceMode: projectDetailApiCheck || projectListingApiCheck
2528
}
2629
}
2730

src/components/Layout/Layout.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import Footer from '../Footer/Footer'
3-
import { MAINTENANCE_MODE } from '../../config/constants'
3+
// import { MAINTENANCE_MODE } from '../../config/constants'
44
import Alert from 'react-s-alert'
55
import cn from 'classnames'
66
import Maintenance from '../Maintenance/Maintenance'
@@ -12,11 +12,11 @@ import '../../styles/vendors/s-alert-default.css'
1212
import 'react-s-alert/dist/s-alert-css-effects/slide.css'
1313

1414
const Layout = (props) => {
15-
const { isLoadingUser } = props
15+
const { isLoadingUser, maintenanceMode } = props
1616

1717
if (isLoadingUser) {
1818
return (<div />)
19-
} else if (MAINTENANCE_MODE) {
19+
} else if (maintenanceMode) {
2020
return <Maintenance />
2121
} else {
2222
return (

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)