aboutsummaryrefslogtreecommitdiff
path: root/src/site/plugins/notifier.js
diff options
context:
space:
mode:
authorZephyrrus <[email protected]>2020-07-09 02:21:35 +0300
committerZephyrrus <[email protected]>2020-07-09 02:21:35 +0300
commit495a23c3a53b8f1e9f885163129d962cbd3e8c2b (patch)
tree87c534d4221f0a5f00536044a6300de8accf6757 /src/site/plugins/notifier.js
parentchore: add unique integrity checks to the database for many-to-many tables (diff)
downloadhost.fuwn.me-495a23c3a53b8f1e9f885163129d962cbd3e8c2b.tar.xz
host.fuwn.me-495a23c3a53b8f1e9f885163129d962cbd3e8c2b.zip
feat: add notifier plugin for 🐍 and 🍞
Diffstat (limited to 'src/site/plugins/notifier.js')
-rw-r--r--src/site/plugins/notifier.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/site/plugins/notifier.js b/src/site/plugins/notifier.js
index f37b96e..4fe1262 100644
--- a/src/site/plugins/notifier.js
+++ b/src/site/plugins/notifier.js
@@ -1,7 +1,25 @@
+import AlertTypes from '~/constants/alertTypes';
+
export default ({ store }, inject) => {
inject('notifier', {
- showMessage({ content = '', type = '' }) {
- store.commit('alert/set', { content, type });
+ showMessage({ message = '', type = '', snackbar = false }) {
+ store.commit('alert/set', { message, type, snackbar });
},
+ message(message, snackbar) {
+ this.showMessage({ message, type: AlertTypes.PRIMARY, snackbar });
+ },
+ info(message, snackbar) {
+ this.showMessage({ message, type: AlertTypes.INFO, snackbar });
+ },
+ warning(message, snackbar) {
+ this.showMessage({ message, type: AlertTypes.WARNING, snackbar });
+ },
+ success(message, snackbar) {
+ this.showMessage({ message, type: AlertTypes.SUCCESS, snackbar });
+ },
+ error(message, snackbar) {
+ this.showMessage({ message, type: AlertTypes.ERROR, snackbar });
+ },
+ types: AlertTypes,
});
};