File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 11
22// change pushing state
3- function changePushingState ( to ) {
3+
4+ let pendingPromise ;
5+
6+ function changePushingState ( to , pendingPromise ) {
47
58 if ( to === true ) {
9+
10+ pendingPromise = pendingPromise ?? null ;
611
712 window . addEventListener ( 'beforeunload' , beforeUnloadListener , { capture : true } ) ;
813
914 } else {
15+
16+ pendingPromise = null ;
1017
1118 window . removeEventListener ( 'beforeunload' , beforeUnloadListener , { capture : true } ) ;
1219
@@ -202,8 +209,17 @@ let git = {
202209 auto_init : false
203210 } ;
204211
205- // post the query
206- const resp = await axios . post ( query , gitToken , repoData ) ;
212+ // create post request with query
213+ const postRequest = axios . post ( query , gitToken , repoData ) ;
214+
215+ // change pushing state
216+ changePushingState ( true , postRequest ) ;
217+
218+ // await the request
219+ const resp = await postRequest ;
220+
221+ // change pushing state
222+ changePushingState ( false ) ;
207223
208224 return resp . full_name ;
209225
You can’t perform that action at this time.
0 commit comments