Leave character page before deleting to prevent UI errors
This commit is contained in:
@@ -6,7 +6,7 @@ let lastSnackbarId = 0;
|
||||
|
||||
function snackbar(data) {
|
||||
globalState.queue.push({
|
||||
data,
|
||||
data, //{text OR content, callback, callbackName} // content is logContent
|
||||
id: ++lastSnackbarId,
|
||||
enqueuedAt: new Date(),
|
||||
shown: false,
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
import Creatures from '/imports/api/creature/Creatures.js';
|
||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||
import removeCreature from '/imports/api/creature/removeCreature.js';
|
||||
import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -61,12 +62,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
remove(){
|
||||
this.$router.push('/characterList');
|
||||
this.$store.dispatch('popDialogStack');
|
||||
removeCreature.call({charId: this.id}, (error) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
this.$router.push('/characterList');
|
||||
this.$store.dispatch('popDialogStack');
|
||||
snackbar({text: error.message || error.toString()});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user