Skip to content

Commit 5235760

Browse files
authored
Merge pull request #31 from keyoke/keyoke/features
update
2 parents bf5d633 + 49e710b commit 5235760

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

src/import-csv-discussions-action.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -287,27 +287,16 @@ class ImportCSVDiscussionsAction implements IContributedMenuSource {
287287
});
288288
}
289289

290-
async postComment(url : string, accessToken : string, body : string) : Promise<string> {
291-
return new Promise(async (resolve, reject)=>{
292-
let response : Response = await this._fetch(url, {
293-
method: 'POST',
294-
headers: {
295-
'Authorization': `Bearer ${accessToken}`,
296-
'Content-Type': 'application/json',
297-
},
298-
body: body
299-
}).then(async (response : Response)=>{
300-
if (response.status >= 200 && response.status < 300) {
301-
let json : string = await response.json();
302-
resolve(json);
303-
}
304-
else {
305-
reject(`Unsuccessful response with status '${response.status}'`);
306-
}
307-
}).catch((error : Error)=>{
308-
reject(error);
309-
});
290+
async postComment(url: string, accessToken: string, body: string) : Promise<any> {
291+
let response: Response = await this._fetch(url, {
292+
method: 'POST',
293+
headers: {
294+
'Authorization': `Bearer ${accessToken}`,
295+
'Content-Type': 'application/json',
296+
},
297+
body: body
310298
});
299+
return await response.json();
311300
};
312301

313302
public execute(actionContext: any) {

0 commit comments

Comments
 (0)