usePreferences
The usePreferences hook is used to fetch and manage user notification preferences. This hook provides access to preference sets and allows you to update user preferences.
Parameters
#Accepts an optional object with the following properties:
The preference set ID to fetch. If not provided, the default preference set will be fetched.
Optional tenant ID for multi-tenant applications.
Returns
#Returns an object with the following properties:
The preference set data including workflows and channels.
Function to update user preferences.
Function to retrieve all preference sets for the user.
Whether preferences are being loaded.
Whether preferences are being revalidated.
Example
#Basic usage
#The following example demonstrates how to use the usePreferences hook to manage user preferences.
With tenant
#For multi-tenant applications, you can specify a tenant:
Getting all preference sets
#You can retrieve all preference sets for the user: