Conv
This commit is contained in:
@@ -39,6 +39,7 @@ import {
|
||||
ALL_SECTION,
|
||||
HIDDEN_ITEMS_SECTION,
|
||||
isHiddenCollection,
|
||||
leaveSharedCollection,
|
||||
} from "ente-new/photos/services/collection";
|
||||
import type {
|
||||
CollectionSummary,
|
||||
@@ -260,7 +261,7 @@ const CollectionOptions: React.FC<CollectionHeaderProps> = ({
|
||||
changeCollectionVisibility(activeCollection, ItemVisibility.visible),
|
||||
);
|
||||
|
||||
const confirmLeaveSharedAlbum = () => {
|
||||
const confirmLeaveSharedAlbum = () =>
|
||||
showMiniDialog({
|
||||
title: t("leave_shared_album_title"),
|
||||
message: t("leave_shared_album_message"),
|
||||
@@ -270,10 +271,10 @@ const CollectionOptions: React.FC<CollectionHeaderProps> = ({
|
||||
action: leaveSharedAlbum,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const leaveSharedAlbum = wrap(async () => {
|
||||
await CollectionAPI.leaveSharedAlbum(activeCollection.id);
|
||||
await leaveSharedCollection(activeCollection.id);
|
||||
setActiveCollectionID(ALL_SECTION);
|
||||
});
|
||||
|
||||
|
||||
@@ -334,22 +334,6 @@ export const deleteCollection = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const leaveSharedAlbum = async (collectionID: number) => {
|
||||
try {
|
||||
const token = getToken();
|
||||
|
||||
await HTTPService.post(
|
||||
await apiURL(`/collections/leave/${collectionID}`),
|
||||
null,
|
||||
null,
|
||||
{ "X-Auth-Token": token },
|
||||
);
|
||||
} catch (e) {
|
||||
log.error("leave shared album failed ", e);
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
export const updateCollectionMagicMetadata = async (
|
||||
collection: Collection,
|
||||
updatedMagicMetadata: CollectionMagicMetadata,
|
||||
|
||||
@@ -304,7 +304,7 @@ export const shareCollection = async (
|
||||
/**
|
||||
* Delete the public link for the collection with given {@link collectionID}.
|
||||
*
|
||||
* Does not modify local state.
|
||||
* Remote only, does not modify local state.
|
||||
*/
|
||||
export const deleteShareURL = async (collectionID: number) =>
|
||||
ensureOk(
|
||||
@@ -313,3 +313,18 @@ export const deleteShareURL = async (collectionID: number) =>
|
||||
headers: await authenticatedRequestHeaders(),
|
||||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* Leave a collection which had previously been shared with the user.
|
||||
*
|
||||
* Remote only, does not modify local state.
|
||||
*
|
||||
* @param collectionID The ID of the shared collection to leave.
|
||||
*/
|
||||
export const leaveSharedCollection = async (collectionID: number) =>
|
||||
ensureOk(
|
||||
await fetch(await apiURL(`/collections/leave/${collectionID}`), {
|
||||
method: "POST",
|
||||
headers: await authenticatedRequestHeaders(),
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user