Skip to content

Commit

Permalink
Merge pull request #2715 from LibreSign/backport/2714/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: handle error message when read certificate
  • Loading branch information
vitormattos authored Apr 12, 2024
2 parents 3aa3ccb + 06069fb commit 1a9877a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/views/ReadCertificate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<header>
<h2>{{ t('libresign', 'Certificate data') }}</h2>
</header>
<NcNoteCard v-if="error" type="error">
<p>{{ error }}</p>
</NcNoteCard>
<table v-if="Object.keys(certificateData).length">
<thead>
<tr>
Expand Down Expand Up @@ -92,7 +95,7 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
import { selectCustonOption } from '../helpers/certification.js'
export default {
Expand All @@ -101,13 +104,15 @@ export default {
NcContent,
NcPasswordField,
NcButton,
NcNoteCard,
NcLoadingIcon,
},
data() {
return {
hasLoading: false,
password: '',
certificateData: [],
error: '',
}
},
methods: {
Expand All @@ -122,13 +127,13 @@ export default {
})
.then(({ data }) => {
this.certificateData = data
this.error = ''
})
.catch(({ response }) => {
this.signMethodsStore.setHasSignatureFile(false)
if (response.data.message) {
showError(response.data.message)
if (response?.data?.message?.length > 0) {
this.error = response.data.message
} else {
showError(t('libresign', 'Error creating new password, please contact the administrator'))
this.error = t('libresign', 'Invalid password')
}
})
this.hasLoading = false
Expand Down

0 comments on commit 1a9877a

Please sign in to comment.