authenticated.js 412 B

12345678910111213
  1. export default function ({ isServer, store, req, redirect }) {
  2. // If nuxt generate, pass this middleware
  3. if (isServer && !req) return
  4. if (!store.state.option.user.logged) {
  5. this.$http.get('/logout/crossBefore').then(response => {
  6. if (response.data) {
  7. window.location.href = response.data.logoutUrl + encodeURIComponent(window.location.host + response.data.baseUrl)
  8. }
  9. })
  10. }
  11. }