Allow issue creation via UI

This commit is contained in:
2019-12-05 22:37:09 +01:00
parent d510116c4b
commit a7297e3d12
17 changed files with 310 additions and 51 deletions

View File

@ -52,6 +52,23 @@ export class GiteaClient {
.then(this.assertAuthorization)
}
createIssue(project, title, body, labelID) {
return fetch(`/gitea/api/v1/repos/${project}/issues`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
title,
body,
labels: [labelID],
}),
})
.then(this.assertOk)
.then(this.assertAuthorization)
.then(res => res.json())
}
assertOk(res) {
if (!res.ok) return Promise.reject(new Error('Request failed'));
return res;