Fix session timeout detection

This commit is contained in:
wpetit 2019-12-06 17:15:18 +01:00
parent 10151db229
commit da6a408634

View File

@ -11,14 +11,15 @@ export class GiteaClient {
fetchIssues(project, page = 1) {
return fetch(`/gitea/api/v1/repos/${project}/issues?page=${page}`)
.then(this.assertAuthorization)
.then(this.assertOk)
.then(res => res.json())
;
}
fetchUserProjects() {
return fetch(`/gitea/api/v1/user/repos`)
.then(this.assertOk)
.then(this.assertAuthorization)
.then(this.assertOk)
.then(res => res.json())
;
}
@ -31,15 +32,15 @@ export class GiteaClient {
},
body: JSON.stringify({ labels: [labelID] }),
})
.then(this.assertOk)
.then(this.assertAuthorization)
.then(this.assertOk)
.then(res => res.json())
}
fetchProjectLabels(project) {
return fetch(`/gitea/api/v1/repos/${project}/labels`)
.then(this.assertOk)
.then(this.assertAuthorization)
.then(this.assertOk)
.then(res => res.json())
;
}
@ -48,8 +49,8 @@ export class GiteaClient {
return fetch(`/gitea/api/v1/repos/${project}/issues/${issueNumber}/labels/${labelID}`, {
method: 'DELETE'
})
.then(this.assertOk)
.then(this.assertAuthorization)
.then(this.assertOk)
}
createIssue(project, title, body, labelID) {
@ -64,8 +65,8 @@ export class GiteaClient {
labels: [labelID],
}),
})
.then(this.assertOk)
.then(this.assertAuthorization)
.then(this.assertOk)
.then(res => res.json())
}