From e577a6e580985a192570bb260620b1a283c6b763 Mon Sep 17 00:00:00 2001 From: nscuro Date: Sun, 4 Sep 2022 16:03:56 +0200 Subject: [PATCH] Fix minor API keys display issues Signed-off-by: nscuro --- src/views/administration/accessmanagement/Teams.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/views/administration/accessmanagement/Teams.vue b/src/views/administration/accessmanagement/Teams.vue index 4508343db..1ddbe778a 100644 --- a/src/views/administration/accessmanagement/Teams.vue +++ b/src/views/administration/accessmanagement/Teams.vue @@ -225,7 +225,11 @@ createApiKey() { let url = `${this.$api.BASE_URL}/${this.$api.URL_TEAM}/${this.team.uuid}/key`; this.axios.put(url).then((response) => { - this.apiKeys.push(response.data); + if (this.apiKeys) { + this.apiKeys.push(response.data); + } else { + this.apiKeys = [response.data]; + } this.$toastr.s(this.$t('message.updated')); }).catch((error) => { this.$toastr.w(this.$t('condition.unsuccessful_action')); @@ -384,7 +388,11 @@ }, syncVariables: function(team) { this.team = team; - this.apiKeys = team.apiKeys; + if (team.apiKeys) { + // Some API server responses don't include API keys. + // Take care to not wipe existing API keys from the UI in those cases. + this.apiKeys = team.apiKeys; + } this.permissions = team.permissions; //this.ldapGroups = team.mappedLdapGroups; }