@magicbell/react-headless
Version:
Hooks to build a notification inbox
26 lines (25 loc) • 1.1 kB
TypeScript
import IRemoteNotificationPreferences from '../../types/IRemoteNotificationPreferences.js';
import NotificationPreferencesRepository from './NotificationPreferencesRepository.js';
export interface INotificationPreferences extends IRemoteNotificationPreferences {
lastFetchedAt?: number;
/**
* Fetch the notification preferences for the current user from the MagicBell server.
*/
fetch: () => Promise<void>;
/**
* Update the notification preferences for the current user.
*
* @preferences Object containing the new preferences.
*/
save: (preferences: IRemoteNotificationPreferences) => Promise<void>;
_repository: NotificationPreferencesRepository;
}
/**
* Remote notification preferences store. It contains all preferences stored in MagicBell servers for this user.
*
* @example
* const { fetch } = useNotificationPreferences();
* useEffect(() => fetch(), []);
*/
declare const useNotificationPreferences: import("zustand").UseBoundStore<import("zustand").StoreApi<INotificationPreferences>>;
export default useNotificationPreferences;