aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/login_form/login_form.js16
-rw-r--r--src/components/oauth_callback/oauth_callback.js4
2 files changed, 12 insertions, 8 deletions
diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js
index dc917e47..0097e18a 100644
--- a/src/components/login_form/login_form.js
+++ b/src/components/login_form/login_form.js
@@ -11,22 +11,26 @@ const LoginForm = {
},
methods: {
oAuthLogin () {
- oauthApi.login({
- oauth: this.$store.state.oauth,
+ const data = {
+ ...this.$store.state.oauth,
instance: this.$store.state.instance.server,
commit: this.$store.commit
- })
+ }
+
+ oauthApi.getOrCreateApp(data)
+ .then((app) => { oauthApi.login({ ...app, ...data }) })
},
submit () {
const data = {
- oauth: this.$store.state.oauth,
- instance: this.$store.state.instance.server
+ ...this.$store.state.oauth,
+ instance: this.$store.state.instance.server,
+ commit: this.$store.commit
}
this.clearError()
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..48ddd10d 100644
--- a/src/components/oauth_callback/oauth_callback.js
+++ b/src/components/oauth_callback/oauth_callback.js
@@ -5,13 +5,13 @@ const oac = {
mounted () {
if (this.code) {
oauth.getToken({
- app: this.$store.state.oauth,
+ ...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({name: 'friends'})
+ this.$router.push({ name: 'friends' })
})
}
}