aboutsummaryrefslogtreecommitdiff
path: root/src/components/editors/brand-editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/editors/brand-editor.js')
-rw-r--r--src/components/editors/brand-editor.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/components/editors/brand-editor.js b/src/components/editors/brand-editor.js
index 7796c68..2b7806e 100644
--- a/src/components/editors/brand-editor.js
+++ b/src/components/editors/brand-editor.js
@@ -16,8 +16,10 @@
*/
import { Brand, saveBrand, editBrand } from './../../classes/brand'
+import { notificationConfig } from "./../../classes/notifications";
import './scss/brand-editor.scss'
+import { Store } from "react-notifications-component";
import { useState } from 'react';
const BrandEditor = (props) => {
@@ -36,13 +38,22 @@ const BrandEditor = (props) => {
}
const handleSuccess = () => {
+ Store.addNotification({
+ title: `Successfully ${props.editing ? "edited" : "added"} brand!`,
+ message: `${name} has successfully been ${props.editing ? "edited" : "saved"}.`,
+ ...notificationConfig("success")
+ });
clearAll();
props.callback();
props.editing && props.hide();
}
- const handleFail = () => {
- alert("fail");
+ const handleFail = err => {
+ Store.addNotification({
+ title: "An error occoured",
+ message: `Failed to ${props.editing ? "edit" : "add"} brand '${name}'. ${err.message}`,
+ ...notificationConfig("danger")
+ });
}
const clearAll = () => {