diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/login_form/login_form.js | 14 | ||||
| -rw-r--r-- | src/components/oauth_callback/oauth_callback.js | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index 1119754e..da302c76 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -26,14 +26,20 @@ const LoginForm = { this.isTokenMethod ? this.submitToken() : this.submitPassword() }, submitToken () { - oauthApi.login({ - oauth: this.oauth, + const { clientId } = this.oauth + const data = { + clientId, instance: this.instance.server, commit: this.$store.commit - }) + } + + oauthApi.getOrCreateApp(data) + .then((app) => { oauthApi.login({ ...app, ...data }) }) }, submitPassword () { + const { clientId } = this.oauth const data = { + clientId, oauth: this.oauth, instance: this.instance.server } @@ -42,7 +48,7 @@ const LoginForm = { oauthApi.getOrCreateApp(data).then((app) => { oauthApi.getTokenWithCredentials( { - app, + ...app, instance: data.instance, username: this.user.username, password: this.user.password diff --git a/src/components/oauth_callback/oauth_callback.js b/src/components/oauth_callback/oauth_callback.js index e3d45ee1..2c6ca235 100644 --- a/src/components/oauth_callback/oauth_callback.js +++ b/src/components/oauth_callback/oauth_callback.js @@ -4,14 +4,16 @@ const oac = { props: ['code'], mounted () { if (this.code) { + const { clientId } = this.$store.state.oauth + oauth.getToken({ - app: this.$store.state.oauth, + clientId, 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({name: 'friends'}) + this.$router.push({ name: 'friends' }) }) } } |
