Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use sessionStorage instead of localStorage for join album context

Anand Baburajan996ae39cfbd4
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index 3c7700b376..d3f30103a6 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -78,7 +78,7 @@ const Page: React.FC = () => {
...(jwtFromURL && { accessTokenJWT: jwtFromURL }),
};
- localStorage.setItem(
+ sessionStorage.setItem(
JOIN_ALBUM_CONTEXT_KEY,
JSON.stringify(context),
);
diff --git a/web/packages/new/albums/services/join-album.ts b/web/packages/new/albums/services/join-album.ts
index e93b49101e..fe59093c22 100644
--- a/web/packages/new/albums/services/join-album.ts
+++ b/web/packages/new/albums/services/join-album.ts
@@ -57,15 +57,15 @@ export const storeJoinAlbumContext = async (
const serializedContext = JSON.stringify(context);
- localStorage.setItem(JOIN_ALBUM_CONTEXT_KEY, serializedContext);
+ sessionStorage.setItem(JOIN_ALBUM_CONTEXT_KEY, serializedContext);
};
/**
* Retrieve stored album context after authentication.
- * Checks localStorage for the stored context.
+ * Checks sessionStorage for the stored context.
*/
export const getJoinAlbumContext = (): JoinAlbumContext | null => {
- const stored = localStorage.getItem(JOIN_ALBUM_CONTEXT_KEY);
+ const stored = sessionStorage.getItem(JOIN_ALBUM_CONTEXT_KEY);
if (!stored) {
return null;
}
@@ -82,7 +82,7 @@ export const getJoinAlbumContext = (): JoinAlbumContext | null => {
* Clear the stored album context after successful join or timeout.
*/
export const clearJoinAlbumContext = () => {
- localStorage.removeItem(JOIN_ALBUM_CONTEXT_KEY);
+ sessionStorage.removeItem(JOIN_ALBUM_CONTEXT_KEY);
};
/**
@@ -166,7 +166,7 @@ export const processPendingAlbumJoin = async (): Promise<number | null> => {
// Update the context with the actual collection ID
const updatedContext = { ...context, collectionID };
- localStorage.setItem(
+ sessionStorage.setItem(
JOIN_ALBUM_CONTEXT_KEY,
JSON.stringify(updatedContext),
);