2018-10-27 00:16:23 +11:00
|
|
|
import oauth from '../../services/new_api/oauth.js'
|
|
|
|
|
|
|
|
const oac = {
|
|
|
|
props: ['code'],
|
|
|
|
mounted () {
|
|
|
|
if (this.code) {
|
|
|
|
oauth.getToken({
|
2019-05-23 02:13:41 +10:00
|
|
|
...this.$store.state.oauth,
|
2018-10-27 00:16:23 +11:00
|
|
|
instance: this.$store.state.instance.server,
|
|
|
|
code: this.code
|
|
|
|
}).then((result) => {
|
2018-10-27 00:20:39 +11:00
|
|
|
this.$store.commit('setToken', result.access_token)
|
|
|
|
this.$store.dispatch('loginUser', result.access_token)
|
2019-05-23 02:13:41 +10:00
|
|
|
this.$router.push({ name: 'friends' })
|
2018-10-27 00:16:23 +11:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default oac
|