mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 11:59:23 +00:00
download button for user pictures and albums
This commit is contained in:
@ -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]) {
|
||||
|
Reference in New Issue
Block a user