Skip to content

Commit 201c74d

Browse files
refactor(signpdf): use store action for pdf load errors
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent b5d83e9 commit 201c74d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/views/SignPDF/SignPDF.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,14 @@ type EnvelopeFileListResponse = {
120120
}
121121
}
122122
123-
type SignStore = Pick<ReturnType<typeof useSignStore>, 'document' | 'errors' | 'mounted' | 'initFromState' | 'setFileToSign' | 'queueAction'> & {
123+
type SignStore = Pick<ReturnType<typeof useSignStore>, 'document' | 'errors' | 'mounted' | 'initFromState' | 'setFileToSign' | 'queueAction' | 'setSigningErrors'> & {
124124
document: SignDocument
125125
errors: SignError[]
126126
mounted: boolean
127127
initFromState: () => Promise<void>
128128
setFileToSign: (file: SignDocument) => void
129129
queueAction: (action: string) => void
130+
setSigningErrors: (newErrors: SignError[]) => void
130131
}
131132
132133
type FilesStore = Pick<ReturnType<typeof useFilesStore>, 'getAllFiles' | 'addFile' | 'selectFile' | 'getFile'> & {
@@ -235,10 +236,11 @@ const PDF_LOAD_ERROR_SCOPE = 'pdfLoad'
235236
const hasPdfLoadError = computed(() => signStore.errors.some((error) => error.scope === PDF_LOAD_ERROR_SCOPE))
236237
237238
function setPdfLoadErrors(errors: SignError[]) {
238-
signStore.errors = errors.map((error) => ({
239+
const mappedErrors = errors.map((error) => ({
239240
...error,
240241
scope: PDF_LOAD_ERROR_SCOPE,
241242
}))
243+
signStore.setSigningErrors(mappedErrors)
242244
}
243245
244246
function getRouteUuid() {

0 commit comments

Comments
 (0)