diff options
| author | Zephyrrus <[email protected]> | 2020-07-04 03:28:05 +0300 |
|---|---|---|
| committer | Zephyrrus <[email protected]> | 2020-07-04 03:28:05 +0300 |
| commit | ac1d6eec5b5ec3093ac97e179d2573b5a225ea0e (patch) | |
| tree | bf767ab16bac9dbeac055c7d398af4cf36f3d2b1 | |
| parent | feat: refactor most of the album components to use store for presentation and... (diff) | |
| download | host.fuwn.me-ac1d6eec5b5ec3093ac97e179d2573b5a225ea0e.tar.xz host.fuwn.me-ac1d6eec5b5ec3093ac97e179d2573b5a225ea0e.zip | |
fix: change watcher from a component watcher to a store watcher
| -rw-r--r-- | src/site/layouts/default.vue | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/site/layouts/default.vue b/src/site/layouts/default.vue index 08d733f..579a73e 100644 --- a/src/site/layouts/default.vue +++ b/src/site/layouts/default.vue @@ -19,21 +19,22 @@ export default { Navbar, Footer }, - computed: mapState(['config', 'alert']), - watch: { - 'alert.text'() { - console.log('aaaaaaaa'); - if (!this.alert.text) return; + computed: mapState(['config']), + created() { + this.$store.watch(state => state.alert.text, () => { + const { text, error } = this.$store.state.alert; + + if (!text) return; this.$buefy.toast.open({ duration: 3500, - message: this.alert.text, + message: text, position: 'is-bottom', - type: this.alert.error ? 'is-danger' : 'is-success' + type: error ? 'is-danger' : 'is-success' }); this.$store.dispatch('alert/clear', null); - } + }) }, mounted() { console.log( |