mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw-ui.git
synced 2025-10-30 18:27:53 +00:00
27 lines
536 B
JavaScript
27 lines
536 B
JavaScript
import { useCallback, useMemo } from 'react';
|
|
import { useToast } from 'ucentral-libs';
|
|
|
|
const useWebSocketNotification = () => {
|
|
const { addToast } = useToast();
|
|
|
|
const pushNotification = useCallback((notification) => {
|
|
addToast({
|
|
title: notification.content.title,
|
|
body: notification.content.details,
|
|
color: 'info',
|
|
autohide: true,
|
|
});
|
|
}, []);
|
|
|
|
const toReturn = useMemo(
|
|
() => ({
|
|
pushNotification,
|
|
}),
|
|
[],
|
|
);
|
|
|
|
return toReturn;
|
|
};
|
|
|
|
export default useWebSocketNotification;
|