diff --git a/packages/nc-gui/components/account/Token.vue b/packages/nc-gui/components/account/Token.vue index 4b671ab454..7809cebd92 100644 --- a/packages/nc-gui/components/account/Token.vue +++ b/packages/nc-gui/components/account/Token.vue @@ -29,8 +29,10 @@ const showNewTokenModal = ref(false) const currentLimit = ref(10) +const defaultTokenName = 'untitled token' + const selectedTokenData = ref({ - description: 'untitled token', + description: defaultTokenName, }) const searchText = ref('') @@ -75,7 +77,7 @@ loadTokens() const isModalOpen = ref(false) const tokenDesc = ref('') const tokenToCopy = ref('') -const isInvalidInput = ref(false) +const isValidTokenName = ref(false) const deleteToken = async (token: string): Promise => { try { @@ -92,9 +94,9 @@ const deleteToken = async (token: string): Promise => { } const generateToken = async () => { - isInvalidInput.value = !selectedTokenData.value.description?.length || selectedTokenData.value.description?.length > 255 + isValidTokenName.value = !selectedTokenData.value.description?.length || selectedTokenData.value.description?.length > 255 - if (isInvalidInput.value) return + if (isValidTokenName.value) return try { await api.orgTokens.create(selectedTokenData.value) showNewTokenModal.value = false @@ -105,7 +107,7 @@ const generateToken = async () => { } catch (e: any) { message.error(await extractSdkResponseErrorMsg(e)) } finally { - selectedTokenData.value.description = 'untitled token' + selectedTokenData.value.description = defaultTokenName $e('a:api-token:generate') } } @@ -143,7 +145,7 @@ const errorMessage = computed(() => { const handleCancel = () => { showNewTokenModal.value = false - isInvalidInput.value = false + isValidTokenName.value = false } @@ -189,7 +191,7 @@ const handleCancel = () => { placeholder="Token Name" data-testid="nc-token-input" /> - {{ errorMessage }} + {{ errorMessage }}