<script>
import storage from 'store'
import { mapMutations } from 'vuex'

import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
  created() {
    const query = this.$route.query
    if (query.token && query.path) {
      storage.set(ACCESS_TOKEN, query.token , 7 * 24 * 60 * 60 * 1000)
      this.$store.commit('SET_TOKEN', query.token)
      this.$router.push({
        path: query.path
      })
    } else {
      this.$router.push({
        path: '/403'
      })
    }
  },
  render(h) {
    return h('div', null)
  }
}
</script>
