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/classes | |
parent | bb38d843de17bb0b206a663e008c5dbb37f04708 (diff) |
added notification system
Diffstat (limited to 'src/classes')
-rw-r--r-- | src/classes/item.js | 8 | ||||
-rw-r--r-- | src/classes/notifications.js | 31 |
2 files changed, 35 insertions, 4 deletions
diff --git a/src/classes/item.js b/src/classes/item.js index 63f65ca..53f4bcd 100644 --- a/src/classes/item.js +++ b/src/classes/item.js @@ -54,25 +54,25 @@ export class InvoiceItem extends Item { export const saveItem = (item, ok, fail) => { axios.post("/item/new", item) .then(res => ok()) - .catch((err) => fail()) + .catch(err => fail(err)) } export const deleteItem = (id, ok, fail) => { axios.delete(`/item/${id}`) .then(res => ok()) - .catch((err) => fail()) + .catch(err => fail(err)) } export const getAllItems = (ok, fail) => { axios.get("/item/all") .then(res => ok(res.data)) - .catch(err => fail()) + .catch(err => fail(err)) } export const editItem = (item, ok, fail) => { axios.put(`/item/${item.Id}`, item) .then(res => ok()) - .catch(err => fail()); + .catch(err => fail(err)); } export const getDiscountValue = (item) => diff --git a/src/classes/notifications.js b/src/classes/notifications.js new file mode 100644 index 0000000..5ffdec8 --- /dev/null +++ b/src/classes/notifications.js @@ -0,0 +1,31 @@ +/* OpenBills-web - Web based libre billing software + * Copyright (C) 2022 Vidhu Kant Sharma <vidhukant@vidhukant.xyz> + + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +// TODO: load defaults from config +export function notificationConfig(type, duration=3000) { + return { + type: type, + insert: "top", + container: "top-right", + animationIn: ["animate__animated", "animate__fadeIn"], + animationOut: ["animate__animated", "animate__fadeOut"], + dismiss: { + duration: duration, + onScreen: true + } + }; +} |