aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_settings/user_settings.js
diff options
context:
space:
mode:
authorMaxim Filippov <colixer@gmail.com>2019-02-12 21:53:59 +0300
committerMaxim Filippov <colixer@gmail.com>2019-02-28 04:04:26 +0300
commit2c7406d9a8d8e961b99286f317c6ed0a48427853 (patch)
tree0812155e91d39de3bb4fc646aa76e827c7dcafa9 /src/components/user_settings/user_settings.js
parent058238c3c631520d052327fcab47c997dfe23151 (diff)
Add OAuth Tokens management to settings
Diffstat (limited to 'src/components/user_settings/user_settings.js')
-rw-r--r--src/components/user_settings/user_settings.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 06e72112..c7dab754 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -1,6 +1,10 @@
+<<<<<<< HEAD
import { compose } from 'vue-compose'
import unescape from 'lodash/unescape'
import get from 'lodash/get'
+=======
+import { unescape, truncate } from 'lodash'
+>>>>>>> Add OAuth Tokens management to settings
import TabSwitcher from '../tab_switcher/tab_switcher.js'
import ImageCropper from '../image_cropper/image_cropper.vue'
@@ -62,6 +66,9 @@ const UserSettings = {
activeTab: 'profile'
}
},
+ created () {
+ this.$store.dispatch('fetchTokens')
+ },
components: {
StyleSwitcher,
TabSwitcher,
@@ -87,8 +94,20 @@ const UserSettings = {
direct: { selected: this.newDefaultScope === 'direct' }
}
},
+<<<<<<< HEAD
currentSaveStateNotice () {
return this.$store.state.interface.settings.currentSaveStateNotice
+=======
+ oauthTokens () {
+ return this.$store.state.oauthTokens.tokens.map(oauthToken => {
+ return {
+ id: oauthToken.id,
+ token: truncate(oauthToken.token, { length: 15 }),
+ refreshToken: truncate(oauthToken.refresh_token, { length: 15 }),
+ validUntil: new Date(oauthToken.valid_until).toLocaleDateString()
+ }
+ })
+>>>>>>> Add OAuth Tokens management to settings
}
},
methods: {
@@ -308,6 +327,11 @@ const UserSettings = {
logout () {
this.$store.dispatch('logout')
this.$router.replace('/')
+ },
+ revokeToken (id) {
+ if(confirm('Are you sure?')) {
+ this.$store.dispatch('revokeToken', id)
+ }
}
}
}