From e7a2a7267dbd8a4ee3d266d22249459d028569d6 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 22 May 2019 19:13:41 +0300 Subject: Proper clientId/secret/token caching, MastoAPI registration --- src/components/login_form/login_form.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/components/login_form/login_form.js') 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 -- cgit v1.2.3-70-g09d2