diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-12-04 21:37:52 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-12-04 21:37:52 +0530 |
commit | 1139da4da7f1bb0ee4a66d420e690beed36832c2 (patch) | |
tree | b0e5fca2f13c691b0c42543d98a747289f527e52 /src/views/manage | |
parent | bb38d843de17bb0b206a663e008c5dbb37f04708 (diff) |
added notification system
Diffstat (limited to 'src/views/manage')
-rw-r--r-- | src/views/manage/brands.js | 12 | ||||
-rw-r--r-- | src/views/manage/clients.js | 10 | ||||
-rw-r--r-- | src/views/manage/items.js | 12 |
3 files changed, 29 insertions, 5 deletions
diff --git a/src/views/manage/brands.js b/src/views/manage/brands.js index dad21e2..4ab3924 100644 --- a/src/views/manage/brands.js +++ b/src/views/manage/brands.js @@ -16,18 +16,26 @@ */ import { useState, useEffect } from 'react'; +import { Store } from "react-notifications-component"; import './scss/management-page.scss' import { Brand, getAllBrands } from '../../classes/brand'; import BrandEditor from './../../components/editors/brand-editor'; import BrandTable from './../../components/tables/brand-table'; +import { notificationConfig } from "./../../classes/notifications"; const ManageBrandsPage = () => { const [brandToEdit, setBrandToEdit] = useState(new Brand()); const [allBrands, setAllBrands] = useState([]); - // TODO: handle error + const updateList = () => - getAllBrands(setAllBrands, () => {}); + getAllBrands(setAllBrands, err => { + Store.addNotification({ + title: "Error while getting Brands list.", + message: err.message, + ...notificationConfig("danger") + }); + }); useEffect(() => { updateList(); diff --git a/src/views/manage/clients.js b/src/views/manage/clients.js index 8445d80..89e5ade 100644 --- a/src/views/manage/clients.js +++ b/src/views/manage/clients.js @@ -20,18 +20,26 @@ */ import { useState, useEffect } from 'react'; +import { Store } from "react-notifications-component"; import './scss/management-page.scss'; import { Client, getAllClients } from '../../classes/client'; import ClientEditor from './../../components/editors/client-editor'; import ClientTable from './../../components/tables/client-table'; +import { notificationConfig } from "./../../classes/notifications"; const ManageClientsPage = () => { const [clientToEdit, setClientToEdit] = useState(new Client()); const [allClients, setAllClients] = useState([]); // TODO: handle error const updateList = () => - getAllClients(setAllClients, () => {}); + getAllClients(setAllClients, err => { + Store.addNotification({ + title: "Error while getting Clients list.", + message: err.message, + ...notificationConfig("danger") + }); + }); useEffect(() => { updateList(); diff --git a/src/views/manage/items.js b/src/views/manage/items.js index 567be7c..2a862bc 100644 --- a/src/views/manage/items.js +++ b/src/views/manage/items.js @@ -20,18 +20,26 @@ */ import { useState, useEffect } from 'react'; +import { Store } from "react-notifications-component"; import './scss/management-page.scss' import { Item, getAllItems } from '../../classes/item'; import ItemEditor from './../../components/editors/item-editor'; import ItemTable from './../../components/tables/item-table'; +import { notificationConfig } from "./../../classes/notifications"; const ManageItemsPage = () => { const [itemToEdit, setItemToEdit] = useState(new Item()); const [allItems, setAllItems] = useState([]); - // TODO: handle error + const updateList = () => - getAllItems(setAllItems, () => {}); + getAllItems(setAllItems, err => { + Store.addNotification({ + title: "Error while getting Items list.", + message: err.message, + ...notificationConfig("danger") + }); + }); useEffect(() => { updateList(); |