<template>
  <div class="main-layout is-h5" :class="{ 'is-fixed': isFixed }">
    <app-header />
    <div v-show="!isFixed">
      <Nuxt />
      <app-footer />
    </div>
  </div>
</template>

<script>
import AppHeader from '@/components/Header'
import AppFooter from '@/components/Footer'
export default {
  components: { AppHeader, AppFooter },
  computed: {
    isFixed() {
      const { searchVisible, menuVisible } = this.$store.state
      return searchVisible || menuVisible
    }
  },
  mounted() {
    pushHistory()
    window.addEventListener(
      'popstate',
      function(e) {
        window.location.reload()
      },
      false
    )

    function pushHistory() {
      var state = {
        title: 'title',
        url: ''
      }
      window.history.pushState(state, 'title', '')
    }
  }
}
</script>
