File tree Expand file tree Collapse file tree 2 files changed +6
-45
lines changed
Expand file tree Collapse file tree 2 files changed +6
-45
lines changed Original file line number Diff line number Diff line change 55 showToast ,
66 updateApplication ,
77 getApplicationById ,
8- addApplicationFeedback ,
98} from './utils.js' ;
109let nextLink ;
1110let isDataLoading = false ;
@@ -127,31 +126,20 @@ function updateUserApplication({ isAccepted, isRequestChanges = false }) {
127126 }
128127
129128 const applicationStatus = isAccepted ? 'accepted' : 'rejected' ;
130- const payload = { status : applicationStatus } ;
131-
132- const promises = [ ] ;
133129 const feedback =
134130 applicationTextarea && applicationTextarea . value
135131 ? applicationTextarea . value . trim ( )
136132 : '' ;
137133
134+ const payload = { status : applicationStatus } ;
138135 if ( feedback ) {
139- promises . push (
140- addApplicationFeedback ( currentApplicationId , {
141- feedback,
142- status : applicationStatus ,
143- } ) ,
144- ) ;
136+ payload . feedback = feedback ;
145137 }
146138
147- promises . push (
148- updateApplication ( {
149- applicationId : currentApplicationId ,
150- applicationPayload : payload ,
151- } ) ,
152- ) ;
153-
154- Promise . all ( promises )
139+ updateApplication ( {
140+ applicationId : currentApplicationId ,
141+ applicationPayload : payload ,
142+ } )
155143 . then ( ( ) => {
156144 showToastMessage ( {
157145 isDev,
Original file line number Diff line number Diff line change @@ -117,32 +117,6 @@ async function updateApplication({ applicationPayload, applicationId }) {
117117 }
118118}
119119
120- async function addApplicationFeedback ( applicationId , feedbackData ) {
121- try {
122- const res = await fetch (
123- `${ BASE_URL } /applications/${ applicationId } /feedback` ,
124- {
125- method : 'PATCH' ,
126- credentials : 'include' ,
127- body : JSON . stringify ( feedbackData ) ,
128- headers : {
129- 'Content-type' : 'application/json' ,
130- } ,
131- } ,
132- ) ;
133-
134- if ( ! res . ok ) {
135- const error = await res . json ( ) ;
136- throw error ;
137- }
138-
139- const data = await res . json ( ) ;
140- return data ;
141- } catch ( error ) {
142- throw error ;
143- }
144- }
145-
146120function showToast ( { message, type } ) {
147121 toast . innerText = message ;
148122
@@ -168,7 +142,6 @@ export {
168142 getApplications ,
169143 getApplicationById ,
170144 updateApplication ,
171- addApplicationFeedback ,
172145 getIsSuperUser ,
173146 showToast ,
174147} ;
You can’t perform that action at this time.
0 commit comments