Feature: Add update trigger for board-creation

This commit is contained in:
winkidney
2019-12-07 17:24:41 +08:00
committed by Isaac Bythewood
parent 68638deeb3
commit e56e315723
3 changed files with 5 additions and 0 deletions

View File

@@ -54,6 +54,7 @@
<script> <script>
import API from './api'; import API from './api';
import ModelForm from './utils/ModelForm'; import ModelForm from './utils/ModelForm';
import bus from './utils/bus';
const fields = ['name']; const fields = ['name'];
@@ -110,6 +111,7 @@ export default {
const promise = API.Board.create(this.createModel.form.name.value); const promise = API.Board.create(this.createModel.form.name.value);
promise.then( promise.then(
(resp) => { (resp) => {
bus.bus.$emit(bus.events.refreshBoards);
self.$emit('boardCreated', resp); self.$emit('boardCreated', resp);
self.$parent.close(); self.$parent.close();
}, },

View File

@@ -62,6 +62,7 @@ import noMore from './noMore.vue';
import scroll from './utils/scroll'; import scroll from './utils/scroll';
import placeholder from '../assets/pinry-placeholder.jpg'; import placeholder from '../assets/pinry-placeholder.jpg';
import BoardEditorUI from './editors/BoardEditUI.vue'; import BoardEditorUI from './editors/BoardEditUI.vue';
import bus from './utils/bus';
function createBoardItem(board) { function createBoardItem(board) {
const defaultPreviewImage = placeholder; const defaultPreviewImage = placeholder;
@@ -194,6 +195,7 @@ export default {
}, },
}, },
created() { created() {
bus.bus.$on(bus.events.refreshBoards, this.reset);
this.registerScrollEvent(); this.registerScrollEvent();
this.initialize(); this.initialize();
}, },

View File

@@ -6,5 +6,6 @@ export default {
bus: eventBus, bus: eventBus,
events: { events: {
refreshPin: 'refreshPin', refreshPin: 'refreshPin',
refreshBoards: 'refreshBoards',
}, },
}; };