Allow issue creation via UI
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user