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