From 9af204b293a9c1b15e472423a4badff505fd662a Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Fri, 26 Oct 2018 15:16:23 +0200 Subject: Move login to oauth. --- src/components/oauth_callback/oauth_callback.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/components/oauth_callback/oauth_callback.js (limited to 'src/components/oauth_callback/oauth_callback.js') diff --git a/src/components/oauth_callback/oauth_callback.js b/src/components/oauth_callback/oauth_callback.js new file mode 100644 index 00000000..60a15412 --- /dev/null +++ b/src/components/oauth_callback/oauth_callback.js @@ -0,0 +1,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 -- cgit v1.2.3-70-g09d2