Fix session timeout detection
This commit is contained in:
parent
10151db229
commit
da6a408634
|
@ -11,14 +11,15 @@ export class GiteaClient {
|
||||||
fetchIssues(project, page = 1) {
|
fetchIssues(project, page = 1) {
|
||||||
return fetch(`/gitea/api/v1/repos/${project}/issues?page=${page}`)
|
return fetch(`/gitea/api/v1/repos/${project}/issues?page=${page}`)
|
||||||
.then(this.assertAuthorization)
|
.then(this.assertAuthorization)
|
||||||
|
.then(this.assertOk)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchUserProjects() {
|
fetchUserProjects() {
|
||||||
return fetch(`/gitea/api/v1/user/repos`)
|
return fetch(`/gitea/api/v1/user/repos`)
|
||||||
.then(this.assertOk)
|
|
||||||
.then(this.assertAuthorization)
|
.then(this.assertAuthorization)
|
||||||
|
.then(this.assertOk)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -31,15 +32,15 @@ export class GiteaClient {
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ labels: [labelID] }),
|
body: JSON.stringify({ labels: [labelID] }),
|
||||||
})
|
})
|
||||||
.then(this.assertOk)
|
|
||||||
.then(this.assertAuthorization)
|
.then(this.assertAuthorization)
|
||||||
|
.then(this.assertOk)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchProjectLabels(project) {
|
fetchProjectLabels(project) {
|
||||||
return fetch(`/gitea/api/v1/repos/${project}/labels`)
|
return fetch(`/gitea/api/v1/repos/${project}/labels`)
|
||||||
.then(this.assertOk)
|
|
||||||
.then(this.assertAuthorization)
|
.then(this.assertAuthorization)
|
||||||
|
.then(this.assertOk)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -48,8 +49,8 @@ export class GiteaClient {
|
||||||
return fetch(`/gitea/api/v1/repos/${project}/issues/${issueNumber}/labels/${labelID}`, {
|
return fetch(`/gitea/api/v1/repos/${project}/issues/${issueNumber}/labels/${labelID}`, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
})
|
})
|
||||||
.then(this.assertOk)
|
|
||||||
.then(this.assertAuthorization)
|
.then(this.assertAuthorization)
|
||||||
|
.then(this.assertOk)
|
||||||
}
|
}
|
||||||
|
|
||||||
createIssue(project, title, body, labelID) {
|
createIssue(project, title, body, labelID) {
|
||||||
|
@ -64,8 +65,8 @@ export class GiteaClient {
|
||||||
labels: [labelID],
|
labels: [labelID],
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
.then(this.assertOk)
|
|
||||||
.then(this.assertAuthorization)
|
.then(this.assertAuthorization)
|
||||||
|
.then(this.assertOk)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue