import SIDEBAR from '@/graphql/gql/local/sidebar.gql';
import TOGGLE_SIDEBAR from '@/graphql/gql/local/mutations/toggleSidebar.gql';

export default {
  methods: {
    closeSidebar(type) {
      if (this.sidebar[type]) {
        this.$apollo.mutate({
          mutation: TOGGLE_SIDEBAR,
          variables: {
            sidebar: {
              [type]: false
            }
          }
        });
      }
    },
  },

  apollo: {
    sidebar: {
      query: SIDEBAR
    }
  },

  data: () => ({
    sidebar: {
      profile: false,
      navigation: false
    }
  })
};
