Fix: Should not load repeated boards list

This commit is contained in:
winkidney
2020-02-10 22:55:36 +08:00
parent edefdfae2f
commit fb6b4ddad3
2 changed files with 4 additions and 3 deletions

View File

@@ -205,7 +205,7 @@ export default {
return;
}
this.status.loading = true;
const promise = API.fetchBoardForUser(this.boardUsername);
const promise = API.fetchBoardForUser(this.boardUsername, this.status.offset);
promise.then(
(resp) => {
const { results, next } = resp.data;

View File

@@ -154,8 +154,9 @@ function fetchPinsForBoard(boardId) {
);
}
function fetchBoardForUser(username) {
const url = `${API_PREFIX}boards/?submitter__username=${username}`;
function fetchBoardForUser(username, offset = 0, limit = 50) {
const prefix = `${API_PREFIX}boards/?submitter__username=${username}`;
const url = `${prefix}&offset=${offset}&limit=${limit}`;
return axios.get(url);
}