2019-02-26 01:17:52 +01:00
|
|
|
<template lang="pug">
|
2019-03-11 00:20:37 +01:00
|
|
|
b-modal(:title="$t('Settings')" hide-footer @hide='$router.go(-1)' :visible='true')
|
|
|
|
|
el-form(inline)
|
|
|
|
|
el-input(v-model="mastodon_instance")
|
|
|
|
|
span(slot='prepend') Mastodon instance
|
|
|
|
|
el-button(slot='append' @click='associate' type='success') Associate
|
2019-02-26 01:17:52 +01:00
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import { mapState, mapActions } from 'vuex'
|
|
|
|
|
import api from '@/api'
|
|
|
|
|
export default {
|
|
|
|
|
props: ['code'],
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
mastodon_instance: '',
|
|
|
|
|
user: {}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: mapState(['oauth']),
|
|
|
|
|
async mounted () {
|
|
|
|
|
const code = this.$route.query.code
|
|
|
|
|
if (code) {
|
|
|
|
|
const res = await api.setCode({code})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const user = await api.getUser()
|
|
|
|
|
this.user = user
|
2019-02-26 14:32:49 +01:00
|
|
|
this.mastodon_instance = user.mastodon_instance
|
2019-02-26 01:17:52 +01:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async associate () {
|
2019-03-11 00:20:37 +01:00
|
|
|
if (!this.mastodon_instance) return
|
2019-02-26 01:17:52 +01:00
|
|
|
const url = await api.getAuthURL({instance: this.mastodon_instance})
|
|
|
|
|
setTimeout( () => window.location.href=url, 100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|