Skip to content

Commit 8407ed7

Browse files
committed
fix(app-info): wait for fetch app info until checking user login
fix #475
1 parent 20e411c commit 8407ed7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/common/containers/App.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ function wrapComponentInAuthStrategy (
4444
componentWillMount () {
4545
const {checkLogin, fetchAppInfo, user} = this.props
4646
const userIsLoggedIn: boolean = !!user.token
47+
// Fetch app info before component mounts in order to ensure that checks
48+
// for enabled modules result use the correct config data.
4749
fetchAppInfo()
48-
checkLogin(userIsLoggedIn)
49-
if (userIsLoggedIn) {
50-
this._checkIfAdmin()
51-
}
50+
.then(() => {
51+
checkLogin(userIsLoggedIn)
52+
if (userIsLoggedIn) {
53+
this._checkIfAdmin()
54+
}
55+
})
5256
}
5357

5458
componentWillReceiveProps (nextProps) {

lib/manager/actions/status.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function checkJobStatus () {
115115
* commits, the repo URL, and the specific configuration used by the backend
116116
* server.
117117
*/
118-
export function fetchAppInfo () {
118+
export async function fetchAppInfo () {
119119
return async function (dispatch: dispatchFn, getState: getStateFn) {
120120
// fetch info. If an error occurs or response json doesn't match, set
121121
// server info to value indicating an unknown commit and repoUrl

0 commit comments

Comments
 (0)