saleor-apps-redis_apl/apps/monitoring/src/lib/use-dashboard-notifications.ts
Przemysław Łada b33bfd35af
Add Saleor Monitoring app (#189)
* initial commit

* Remove pre-commit-config

* Update gitignore

* Update README

* Add better config for monitoring app (#190)

---------

Co-authored-by: Lukasz Ostrowski <lukasz.ostrowski@saleor.io>
2023-02-22 12:23:04 +01:00

30 lines
658 B
TypeScript

import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
export const useDashboardNotifications = () => {
const { appBridge } = useAppBridge();
const showSuccessNotification = (title: string, text: string) => {
appBridge?.dispatch(
actions.Notification({
title: title,
text: text,
status: "success",
})
);
};
const showErrorNotification = (title: string, text: string) => {
appBridge?.dispatch(
actions.Notification({
title: title,
text: text,
status: "error",
})
);
};
return {
showSuccessNotification,
showErrorNotification,
};
};