Files
habitica/website/client/src/mixins/openedItemRows.js
T
Matteo Pagliazzi e0e9811ab6 lint common
2019-10-09 20:08:36 +02:00

30 lines
593 B
JavaScript

/* eslint-disable camelcase */
import { mapState } from '@/libs/store';
export default {
computed: {
...mapState({
openedItemRows: 'openedItemRows',
}),
},
methods: {
$_openedItemRows_toggleByType (typeId, add) {
const array = this.$store.state.openedItemRows;
if (add) {
array.push(typeId);
} else {
const index = array.indexOf(typeId);
if (index > -1) {
array.splice(index, 1);
}
}
},
$_openedItemRows_isToggled (typeId) {
return this.openedItemRows.includes(typeId);
},
},
};