Skip to content

Commit b864ef1

Browse files
committed
feat: replace error toast with NcNoteCard in password creation modal
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 3885c73 commit b864ef1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/views/CreatePassword.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
@submit.prevent="send()"
1010
@closing="signMethodsStore.closeModal('createPassword')">
1111
<p>{{ t('libresign', 'For security reasons, you must create a password to sign the documents. Enter your new password in the field below.') }}</p>
12+
<NcNoteCard v-if="errorMessage" type="error">
13+
{{ errorMessage }}
14+
</NcNoteCard>
1215
<NcPasswordField v-model="password"
1316
:disabled="hasLoading"
1417
:label="t('libresign', 'Enter a password')"
@@ -29,20 +32,21 @@
2932

3033
<script>
3134
import axios from '@nextcloud/axios'
32-
import { showError, showSuccess } from '@nextcloud/dialogs'
35+
import { showSuccess } from '@nextcloud/dialogs'
3336
import { generateOcsUrl } from '@nextcloud/router'
3437
3538
import NcButton from '@nextcloud/vue/components/NcButton'
3639
import NcDialog from '@nextcloud/vue/components/NcDialog'
3740
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
41+
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
3842
import NcPasswordField from '@nextcloud/vue/components/NcPasswordField'
3943
4044
import { useSignMethodsStore } from '../store/signMethods.js'
41-
4245
export default {
4346
name: 'CreatePassword',
4447
components: {
4548
NcDialog,
49+
NcNoteCard,
4650
NcPasswordField,
4751
NcButton,
4852
NcLoadingIcon,
@@ -55,11 +59,13 @@ export default {
5559
return {
5660
hasLoading: false,
5761
password: '',
62+
errorMessage: '',
5863
}
5964
},
6065
methods: {
6166
async send() {
6267
this.hasLoading = true
68+
this.errorMessage = ''
6369
await axios.post(generateOcsUrl('/apps/libresign/api/v1/account/signature'), {
6470
signPassword: this.password,
6571
})
@@ -73,9 +79,9 @@ export default {
7379
.catch(({ response }) => {
7480
this.signMethodsStore.setHasSignatureFile(false)
7581
if (response.data?.ocs?.data?.message) {
76-
showError(response.data.ocs.data.message)
82+
this.errorMessage = response.data.ocs.data.message
7783
} else {
78-
showError(t('libresign', 'Error creating new password, please contact the administrator'))
84+
this.errorMessage = t('libresign', 'Error creating new password, please contact the administrator')
7985
}
8086
this.$emit('password:created', false)
8187
})

0 commit comments

Comments
 (0)