
export default function ({ isServer, store, req, redirect }) {
  // If nuxt generate, pass this middleware
  if (isServer && !req) return

  if (!store.state.option.user.logged) {
    this.$http.get('/logout/crossBefore').then(response => {
      if (response.data) {
        window.location.href = response.data.logoutUrl + encodeURIComponent(window.location.protocol + '//' + window.location.host + response.data.baseUrl)
      }
    })
  }
}
