
* 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>
30 lines
658 B
TypeScript
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,
|
|
};
|
|
};
|