Apply some review comments

This commit is contained in:
2025-02-20 18:13:40 +01:00
parent f7ff77b88f
commit a87016a23f
5 changed files with 39 additions and 35 deletions

View File

@ -17,7 +17,6 @@ document.addEventListener("alpine:init", () => {
page: Number.parseInt(initialUrlParams.get("page")) || 1,
pushstate: History.Push /* Used to avoid pushing a state on a back action */,
loading: false,
config: {} as AlbumConfig,
async init() {
await this.fetchPictures();
@ -34,6 +33,13 @@ document.addEventListener("alpine:init", () => {
this.config = config;
},
getPage(page: number) {
return this.pictures.slice(
(page - 1) * config.maxPageSize,
config.maxPageSize * page,
);
},
async fetchPictures() {
this.loading = true;
this.pictures = await paginated(picturesFetchPictures, {