diff options
| author | Roger Braun <roger@rogerbraun.net> | 2018-11-13 20:21:04 +0100 |
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2018-11-13 20:21:04 +0100 |
| commit | 7f13cbc493862cfe3f93f7e33e14cf73de92de66 (patch) | |
| tree | 8cceac003cb8ff5e6de43000e25dfb07debcf58a /src/components/registration/registration.js | |
| parent | ffb9d4faf5c6cebb89947a0a9a085fa07e295d42 (diff) | |
| parent | 11f8a4f312675a82d5fed9c5e75fed63a8456ffc (diff) | |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma-fe into dm-tab
Diffstat (limited to 'src/components/registration/registration.js')
| -rw-r--r-- | src/components/registration/registration.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index 8f59878d..f7f8a720 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -1,3 +1,5 @@ +import oauthApi from '../../services/new_api/oauth.js' + const registration = { data: () => ({ user: {}, @@ -25,9 +27,23 @@ const registration = { this.$store.state.api.backendInteractor.register(this.user).then( (response) => { if (response.ok) { - this.$store.dispatch('loginUser', this.user) - this.$router.push('/main/all') - this.registering = false + const data = { + oauth: this.$store.state.oauth, + instance: this.$store.state.instance.server + } + oauthApi.getOrCreateApp(data).then((app) => { + oauthApi.getTokenWithCredentials( + { + app, + instance: data.instance, + username: this.user.username, + password: this.user.password}) + .then((result) => { + this.$store.commit('setToken', result.access_token) + this.$store.dispatch('loginUser', result.access_token) + this.$router.push('/main/friends') + }) + }) } else { this.registering = false response.json().then((data) => { |
