Merge branch 'develop' into dist/ubuntu/bionic/develop
This commit is contained in:
commit
ca7b8aac47
|
@ -5,9 +5,18 @@ import { gitea } from '../../util/gitea';
|
||||||
export function* fetchIssuesSaga(action) {
|
export function* fetchIssuesSaga(action) {
|
||||||
const { project } = action;
|
const { project } = action;
|
||||||
|
|
||||||
let issues;
|
let issues = [];
|
||||||
try {
|
try {
|
||||||
issues = yield call(gitea.fetchIssues.bind(gitea), action.project);
|
let page = 1;
|
||||||
|
while(true) {
|
||||||
|
let pageIssues = yield call(gitea.fetchIssues.bind(gitea), action.project, page);
|
||||||
|
if (pageIssues.length === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
issues.push(...pageIssues);
|
||||||
|
page++;
|
||||||
|
}
|
||||||
|
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
yield put({ type: FETCH_ISSUES_FAILURE, project, error });
|
yield put({ type: FETCH_ISSUES_FAILURE, project, error });
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -8,8 +8,8 @@ export class GiteaUnauthorizedError extends Error {
|
||||||
|
|
||||||
export class GiteaClient {
|
export class GiteaClient {
|
||||||
|
|
||||||
fetchIssues(project) {
|
fetchIssues(project, page = 1) {
|
||||||
return fetch(`/gitea/api/v1/repos/${project}/issues`)
|
return fetch(`/gitea/api/v1/repos/${project}/issues?page=${page}`)
|
||||||
.then(this.assertAuthorization)
|
.then(this.assertAuthorization)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue