import Cookies from 'js-cookie' export default { state: { sidebar: { opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, withoutAnimation: false }, device: 'desktop' }, toggleSideBar: function() { this.state.sidebar.opened = !this.state.sidebar.opened this.state.sidebar.withoutAnimation = false if (this.state.sidebar.opened) { Cookies.set('sidebarStatus', 1) } else { Cookies.set('sidebarStatus', 0) } }, closeSideBar: function({ withoutAnimation }) { Cookies.set('sidebarStatus', 0) this.state.sidebar.opened = false this.state.sidebar.withoutAnimation = withoutAnimation }, toggleDevice: function(device) { this.state.device = device } }