Add toast component interactions
Include boostrap toast component to communicate success
and error requests on the local user management page.
- Created BVToastMixin to share initialization options
- Used async/await pattern to make sure toasts are shown
after asynchronous calls are complete
- Followed current AngularJS pattern of manual dismiss for
error toast and automatic dismiss for success toast
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I5d5c037b5f41781972106fb5e9a2096cc72c39ab
diff --git a/src/components/Mixins/BVToastMixin.js b/src/components/Mixins/BVToastMixin.js
new file mode 100644
index 0000000..489173c
--- /dev/null
+++ b/src/components/Mixins/BVToastMixin.js
@@ -0,0 +1,24 @@
+const BVToastMixin = {
+ methods: {
+ successToast(message) {
+ this.$root.$bvToast.toast(message, {
+ title: 'Success',
+ variant: 'success',
+ autoHideDelay: 10000, //auto hide in milliseconds
+ isStatus: true,
+ solid: true
+ });
+ },
+ errorToast(message) {
+ this.$root.$bvToast.toast(message, {
+ title: 'Error',
+ variant: 'danger',
+ noAutoHide: true,
+ isStatus: true,
+ solid: true
+ });
+ }
+ }
+};
+
+export default BVToastMixin;