aboutsummaryrefslogtreecommitdiff
path: root/src/components/oauth_callback/oauth_callback.js
blob: 18e2415939e2c2e3a21cb8df31ee4ea3b561e3f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import oauth from '../../services/new_api/oauth.js'

const oac = {
  props: ['code'],
  mounted () {
    if (this.code) {
      oauth.getToken({
        app: this.$store.state.oauth,
        instance: this.$store.state.instance.server,
        code: this.code
      }).then((result) => {
        this.$store.commit('setToken', result.access_token)
        this.$store.dispatch('loginUser', result.access_token)
        this.$router.push('/~/main/friends')
      })
    }
  }
}

export default oac