UNPKG

@replyke/react-js

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

31 lines 1.01 kB
import { useAccountSync, useProject, handleError } from "@replyke/core"; const STORAGE_KEY_PREFIX = "replyke-accounts:"; const webAccountStorage = { async getAccountMap(projectId) { try { const raw = localStorage.getItem(`${STORAGE_KEY_PREFIX}${projectId}`); return raw ? JSON.parse(raw) : null; } catch { return null; } }, async setAccountMap(projectId, map) { try { localStorage.setItem(`${STORAGE_KEY_PREFIX}${projectId}`, JSON.stringify(map)); } catch (error) { handleError(error, "Failed to write account map to localStorage"); } }, async deleteAccountMap(projectId) { localStorage.removeItem(`${STORAGE_KEY_PREFIX}${projectId}`); }, }; function AccountManager() { const { projectId } = useProject(); useAccountSync(webAccountStorage, projectId); return null; } export default AccountManager; //# sourceMappingURL=AccountManager.js.map