♻️ (notif) add queue notif service to lazy load notif lib
This commit is contained in:
29
src/components/QueueNotif.vue
Normal file
29
src/components/QueueNotif.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<span class="queue-notif"></span>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator'
|
||||
import queueNotifService from '@/services/QueueNotifService'
|
||||
import notif from '@/utils/notif'
|
||||
|
||||
@Component
|
||||
export default class QueueNotif extends Vue {
|
||||
public mounted() {
|
||||
queueNotifService.subscribe((notification) => {
|
||||
switch (notification.type) {
|
||||
case 'success':
|
||||
notif.success(notification.message)
|
||||
break
|
||||
case 'error':
|
||||
notif.error(notification.message)
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
public beforeDestroy() {
|
||||
queueNotifService.unsubscribe()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user