download button for user pictures and albums

This commit is contained in:
Kenneth SOARES
2025-02-17 14:57:00 +01:00
committed by Sli
parent a96b374ad7
commit 8cb53ceba2
4 changed files with 38 additions and 18 deletions

View File

@ -30,7 +30,8 @@ import { picturesFetchPictures } from "#openapi";
/**
* @typedef PicturePageConfig
* @property {number} userId Id of the user to get the pictures from
* @property {number} userId Id of the user to get the pictures from (optional if albumId defined)
* @property {number} albumId Id of the album to get the pictures from (optinal if userId defined)
**/
/**
@ -46,9 +47,17 @@ window.loadPicturePage = (config) => {
albums: {},
async init() {
this.pictures = await paginated(picturesFetchPictures, {
let query = {};
if (config.userId) {
// biome-ignore lint/style/useNamingConvention: api is in snake_case
query: { users_identified: [config.userId] },
query = { users_identified: [config.userId] };
} else {
// biome-ignore lint/style/useNamingConvention: api is in snake_case
query = { album_id: config.albumId };
}
this.pictures = await paginated(picturesFetchPictures, {
query,
});
this.albums = this.pictures.reduce((acc, picture) => {
if (!acc[picture.album]) {