4
4
*/
5
5
6
6
import _ from 'lodash' ;
7
+ import { config } from 'topcoder-react-utils' ;
7
8
import { createActions } from 'redux-actions' ;
8
9
import { getService as getChallengesService } from '../services/challenges' ;
9
10
import { getApiV2 } from '../services/api' ;
@@ -106,7 +107,13 @@ function registerDone(auth, challengeId) {
106
107
. register ( challengeId )
107
108
/* As a part of registration flow we silently update challenge details,
108
109
* reusing for this purpose the corresponding action handler. */
109
- . then ( ( ) => getDetailsDone ( challengeId , auth . tokenV3 , auth . tokenV2 ) ) ;
110
+ // Uses a delay to allow API time to update
111
+ . then ( ( ) => new Promise (
112
+ resolve => setTimeout (
113
+ ( ) => resolve ( getDetailsDone ( challengeId , auth . tokenV3 , auth . tokenV2 ) ) ,
114
+ config . CHALLENGE_DETAILS_REFRESH_DELAY ,
115
+ ) ,
116
+ ) ) ;
110
117
}
111
118
112
119
/**
@@ -131,7 +138,13 @@ function unregisterDone(auth, challengeId) {
131
138
. unregister ( challengeId )
132
139
/* As a part of unregistration flow we silently update challenge details,
133
140
* reusing for this purpose the corresponding action handler. */
134
- . then ( ( ) => getDetailsDone ( challengeId , auth . tokenV3 , auth . tokenV2 ) ) ;
141
+ // Uses a delay to allow API time to update
142
+ . then ( ( ) => new Promise (
143
+ resolve => setTimeout (
144
+ ( ) => resolve ( getDetailsDone ( challengeId , auth . tokenV3 , auth . tokenV2 ) ) ,
145
+ config . CHALLENGE_DETAILS_REFRESH_DELAY ,
146
+ ) ,
147
+ ) ) ;
135
148
}
136
149
137
150
/**
0 commit comments