From c621da4fd682990af1520e0313dd763c621b041f Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 10 Jan 2019 16:04:13 +0100 Subject: Do not load 2fa admin settings async Signed-off-by: Roeland Jago Douma --- settings/src/components/AdminTwoFactor.vue | 33 +++++++++++------------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'settings/src/components/AdminTwoFactor.vue') diff --git a/settings/src/components/AdminTwoFactor.vue b/settings/src/components/AdminTwoFactor.vue index 5feaa75af21..0a20bf1b9e3 100644 --- a/settings/src/components/AdminTwoFactor.vue +++ b/settings/src/components/AdminTwoFactor.vue @@ -77,33 +77,24 @@ }, data () { return { - state: { - enforced: false, - enforcedGroups: [], - excludedGroups: [], - }, loading: false, groups: [], loadingGroups: false, } }, + computed: { + state: function() { + return { + enforced: this.$store.state.enforced, + enforcedGroups: this.$store.state.enforcedGroups, + excludedGroups: this.$store.state.excludedGroups, + } + } + }, mounted () { - this.loading = true - Axios.get(OC.generateUrl('/settings/api/admin/twofactorauth')) - .then(resp => resp.data) - .then(state => { - this.state = state - - // Groups are loaded dynamically, but the assigned ones *should* - // be valid groups, so let's add them as initial state - this.groups = _.sortedUniq(this.state.enforcedGroups.concat(this.state.excludedGroups)) - - this.loading = false - }) - .catch(err => { - console.error('Could not load two-factor state', err) - throw err - }) + // Groups are loaded dynamically, but the assigned ones *should* + // be valid groups, so let's add them as initial state + this.groups = _.sortedUniq(this.state.enforcedGroups.concat(this.state.excludedGroups)) }, methods: { searchGroup: _.debounce(function (query) { -- cgit v1.2.3