Skip to main content
Version: 1.1.0

useCADataverseNotificationCenter

@spartanfx/react v1.1.0


@spartanfx/react / codeapps / useCADataverseNotificationCenter

Function: useCADataverseNotificationCenter()

function useCADataverseNotificationCenter(config): INotificationCenterHook;

Power Apps Code Apps NotificationCenter hook backed by Dataverse.

Consumes a generated <Table>Service from pac code add-data-source -a dataverse.

Parameters

config

IUseCADataverseNotificationCenterConfig

Returns

INotificationCenterHook

Example

import { NotificationsService } from './generated/services/NotificationsService';
import { useCADataverseNotificationCenter } from '@spartanfx/react/codeapps';

const hook = useCADataverseNotificationCenter({
service: NotificationsService,
schema: {
id: 'cr1a3_notificationid',
title: 'cr1a3_title',
message: 'cr1a3_message',
level: 'cr1a3_level',
isRead: 'cr1a3_isread',
},
onNotify: (level, msg) => toast[level](msg),
});
return <NotificationCenter provider={hook} />;