1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/core/mixins/undoRedo.js
2023-06-28 16:31:32 +00:00

30 lines
674 B
JavaScript

import { mapGetters } from 'vuex'
import { notifyIf } from '@baserow/modules/core/utils/error'
export default {
computed: {
...mapGetters({
undoLoading: 'undoRedo/isUndoing',
redoLoading: 'undoRedo/isRedoing',
}),
},
methods: {
async undo(showLoadingToast = true) {
await this.action('undo', showLoadingToast)
},
async redo(showLoadingToast = true) {
await this.action('redo', showLoadingToast)
},
async action(name, showLoadingToast = true) {
try {
await this.$store.dispatch(`undoRedo/${name}`, {
showLoadingToast,
})
} catch (e) {
notifyIf(e)
}
},
},
}