From 102f700d96556424e4b59fcc9fadd65c1a377225 Mon Sep 17 00:00:00 2001
From: Christoph Wurst <christoph@winzerhof-wurst.at>
Date: Fri, 1 Mar 2019 14:09:54 +0100
Subject: Load auth tokens with the initial state API

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
---
 settings/src/components/AuthTokenSection.vue | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

(limited to 'settings/src/components/AuthTokenSection.vue')

diff --git a/settings/src/components/AuthTokenSection.vue b/settings/src/components/AuthTokenSection.vue
index e5be46fba15..6d70059abd6 100644
--- a/settings/src/components/AuthTokenSection.vue
+++ b/settings/src/components/AuthTokenSection.vue
@@ -24,7 +24,6 @@
 		<h2>{{ t('settings', 'Devices & sessions') }}</h2>
 		<p class="settings-hint hidden-when-empty">{{ t('settings', 'Web, desktop and mobile clients currently logged in to your account.') }}</p>
 		<AuthTokenList :tokens="tokens"
-					   :loading="loading"
 					   @toggleScope="toggleTokenScope"
 					   @rename="rename"
 					   @delete="deleteToken"/>
@@ -48,31 +47,21 @@
 
 	export default {
 		name: "AuthTokenSection",
+		props: {
+			tokens: {
+				type: Array,
+				requried: true,
+			},
+		},
 		components: {
 			AuthTokenSetupDialogue,
 			AuthTokenList
 		},
 		data() {
 			return {
-				loading: true,
 				baseUrl: OC.generateUrl('/settings/personal/authtokens'),
-				tokens: [],
 			}
 		},
-		mounted() {
-			Axios.get(this.baseUrl)
-				.then(resp => resp.data)
-				.then(tokens => {
-					console.debug('loaded app tokens', tokens);
-					this.loading = false;
-					this.tokens = tokens;
-				})
-				.catch(err => {
-					OC.Notification.showTemporary(t('core', 'Error while loading browser sessions and device tokens'));
-					console.error('could not load app tokens', err);
-					throw err;
-				});
-		},
 		methods: {
 			addNewToken (name) {
 				console.debug('creating a new app token', name);
-- 
cgit v1.2.3

