Skip to content

Commit 3b14cb9

Browse files
fix: hydrate internal sign view from file detail
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 4bbd507 commit 3b14cb9

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

src/views/SignPDF/SignPDF.vue

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type SignStore = Pick<ReturnType<typeof useSignStore>, 'document' | 'errors' | '
131131
}
132132
133133
type FilesStore = Pick<ReturnType<typeof useFilesStore>, 'getAllFiles' | 'addFile' | 'selectFile' | 'getFile'> & {
134-
getAllFiles: (filter: { signer_uuid?: string; details?: boolean }) => Promise<Record<string, SignDocument>>
134+
fetchFileDetail: (options: { fileId?: number | null; uuid?: string | null; force?: boolean }) => Promise<SignDocument | null>
135135
addFile: (file: SignDocumentFile) => void
136136
selectFile: (fileId: number) => void
137137
getFile: () => { status?: SignDocumentStatus } | null
@@ -287,22 +287,15 @@ async function initSignExternal() {
287287
}
288288
289289
async function initSignInternal() {
290-
const files = await filesStore.getAllFiles({
291-
signer_uuid: getRouteUuid(),
292-
details: true,
290+
const file = await filesStore.fetchFileDetail({
291+
uuid: getRouteUuid(),
292+
force: true,
293293
})
294-
for (const key in files) {
295-
const file = files[key]
296-
if (!file) {
297-
continue
298-
}
299-
const signer = file.signers?.find((row) => row?.me === true)
300-
if (signer) {
301-
signStore.setFileToSign(file)
302-
filesStore.selectFile(parseInt(key, 10))
303-
return
304-
}
294+
if (!file || typeof file.id !== 'number') {
295+
return
305296
}
297+
signStore.setFileToSign(file)
298+
filesStore.selectFile(file.id)
306299
}
307300
308301
async function initIdDocsApprove() {
@@ -587,6 +580,10 @@ onBeforeMount(async () => {
587580
})
588581
589582
onMounted(() => {
583+
const routeName = getRoute().name
584+
if (!isMobile && (routeName === 'SignPDF' || routeName === 'IdDocsApprove')) {
585+
sidebarStore.activeSignTab()
586+
}
590587
void getCompatMethod('setupElementClickListener')()
591588
})
592589

0 commit comments

Comments
 (0)