import Vue from 'vue'; import VueCompositionAPI, { computed, reactive } from '@vue/composition-api'; Vue.use(VueCompositionAPI); const state = reactive({ isCartSidebarOpen: false, isWishlistSidebarOpen: false, isLoginModalOpen: false, isCategoryGridView: true, isFilterSidebarOpen: false }); const index = () => { const isCartSidebarOpen = computed(() => state.isCartSidebarOpen); const toggleCartSidebar = () => { state.isCartSidebarOpen = !state.isCartSidebarOpen; }; const isWishlistSidebarOpen = computed(() => state.isWishlistSidebarOpen); const toggleWishlistSidebar = () => { state.isWishlistSidebarOpen = !state.isWishlistSidebarOpen; }; const isLoginModalOpen = computed(() => state.isLoginModalOpen); const toggleLoginModal = () => { state.isLoginModalOpen = !state.isLoginModalOpen; }; const isCategoryGridView = computed(() => state.isCategoryGridView); const changeToCategoryGridView = () => { state.isCategoryGridView = true; }; const changeToCategoryListView = () => { state.isCategoryGridView = false; }; const isFilterSidebarOpen = computed(() => state.isFilterSidebarOpen); const toggleFilterSidebar = () => { state.isFilterSidebarOpen = !state.isFilterSidebarOpen; }; return { isCartSidebarOpen, isWishlistSidebarOpen, isLoginModalOpen, isCategoryGridView, isFilterSidebarOpen, toggleCartSidebar, toggleWishlistSidebar, toggleLoginModal, changeToCategoryGridView, changeToCategoryListView, toggleFilterSidebar }; }; export default index;