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(getStoreKey(userId), undefined); export const setLastActivePath = (userId: string, path: string): void => { setLocalStorageItem(getStoreKey(userId), path); };