albums: fix deletion from shares

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/767/head
Varun Patil 2023-08-02 15:34:45 -07:00
parent ce2b5f2fae
commit 0f875c2d2d
1 changed files with 7 additions and 4 deletions

View File

@ -51,7 +51,6 @@ export async function getAlbums(sort: 1 | 2 = 1, fileid?: number) {
export async function* addToAlbum(user: string, name: string, photos: IPhoto[]) { export async function* addToAlbum(user: string, name: string, photos: IPhoto[]) {
// Get files data // Get files data
let fileInfos = await base.getFiles(photos); let fileInfos = await base.getFiles(photos);
const albumPath = getAlbumPath(user, name); const albumPath = getAlbumPath(user, name);
// Add each file // Add each file
@ -88,10 +87,14 @@ export async function* addToAlbum(user: string, name: string, photos: IPhoto[])
* @returns Generator * @returns Generator
*/ */
export async function* removeFromAlbum(user: string, name: string, photos: IPhoto[]) { export async function* removeFromAlbum(user: string, name: string, photos: IPhoto[]) {
// Add each file // Get files data
const calls = photos.map((f) => async () => { let fileInfos = await base.getFiles(photos);
const albumPath = getAlbumPath(user, name);
// Remove each file
const calls = fileInfos.map((f) => async () => {
try { try {
await client.deleteFile(`/photos/${user}/albums/${name}/${f.fileid}-${f.basename}`); await client.deleteFile(`${albumPath}/${f.fileid}-${f.basename}`);
return f.fileid; return f.fileid;
} catch (e) { } catch (e) {
showError( showError(