Files
cinny/src/app/state/lastActivePath.ts
T
litruv f2caef5592
Trigger cinny-mobile / dispatch (push) Successful in 1s
Open the last seen channel on startup.
2026-10-06 00:37:57 +11:00

17 lines
638 B
TypeScript

import { getLocalStorageItem, setLocalStorageItem } from './utils/atomWithLocalStorage';
const LAST_ACTIVE_PATH_KEY = 'lastActivePath';
const getStoreKey = (userId: string): string => `${LAST_ACTIVE_PATH_KEY}${userId}`;
/**
* Last channel (room route) the user opened, remembered per account so the app
* reopens there on startup instead of the inbox.
*/
export const getLastActivePath = (userId: string): string | undefined =>
getLocalStorageItem<string | undefined>(getStoreKey(userId), undefined);
export const setLastActivePath = (userId: string, path: string): void => {
setLocalStorageItem(getStoreKey(userId), path);
};