diff --git a/src/Components/Request/RequestSignature.vue b/src/Components/Request/RequestSignature.vue index 3bca1e05a4..97c8aa8e03 100644 --- a/src/Components/Request/RequestSignature.vue +++ b/src/Components/Request/RequestSignature.vue @@ -78,6 +78,7 @@ import IdentifySigner from './IdentifySigner.vue' import VisibleElements from './VisibleElements.vue' import { loadState } from '@nextcloud/initial-state' import { useFilesStore } from '../../store/files.js' +import { useSignStore } from '../../store/sign.js' export default { name: 'RequestSignature', @@ -93,7 +94,8 @@ export default { }, setup() { const filesStore = useFilesStore() - return { filesStore } + const signStore = useSignStore() + return { filesStore, signStore } }, data() { return { @@ -194,6 +196,7 @@ export default { } return accumulator }, '') + this.signStore.document = this.filesStore.getFile() const route = this.$router.resolve({ name: 'SignPDF', params: { uuid } }) this.modalSrc = route.href this.showSignModal = true diff --git a/src/store/sign.js b/src/store/sign.js index 4852114580..8675beecd8 100644 --- a/src/store/sign.js +++ b/src/store/sign.js @@ -25,14 +25,13 @@ import { loadState } from '@nextcloud/initial-state' export const useSignStore = defineStore('sign', { state: () => ({ errors: [], - pdf: '', - uuid: '', document: { - filename: '', + name: '', description: '', status: '', statusText: '', - fileId: 0, + url: '', + uuid: '', signers: [], visibleElements: [], }, @@ -41,14 +40,14 @@ export const useSignStore = defineStore('sign', { actions: { initFromState() { this.errors = loadState('libresign', 'errors', []) - this.pdf = loadState('libresign', 'pdf') - this.uuid = loadState('libresign', 'uuid', null) + const pdf = loadState('libresign', 'pdf', []) this.document = { - filename: loadState('libresign', 'filename'), - description: loadState('libresign', 'description'), + name: loadState('libresign', 'filename'), + description: loadState('libresign', 'description', ''), status: loadState('libresign', 'status'), statusText: loadState('libresign', 'statusText'), - fileId: loadState('libresign', 'fileId', 0), + url: pdf.url, + uuid: loadState('libresign', 'uuid', null), signers: loadState('libresign', 'signers', []), visibleElements: loadState('libresign', 'visibleElements', []), } diff --git a/src/views/SignPDF/SignPDF.vue b/src/views/SignPDF/SignPDF.vue index 2bdd5bb2b9..adadd7396c 100644 --- a/src/views/SignPDF/SignPDF.vue +++ b/src/views/SignPDF/SignPDF.vue @@ -6,7 +6,7 @@

- {{ signStore.document.filename }} + {{ signStore.document.name }}
{{ signStore.document.statusText }} @@ -34,7 +34,7 @@ ref="pdfEditor" width="100%" height="100%" - :file-src="signStore.pdf.url" + :file-src="signStore.document.url" :read-only="true" @pdf-editor:end-init="updateSigners" /> @@ -86,11 +86,13 @@ export default { }, }, mounted() { - this.signStore.initFromState() - this.mounted = true - if (!this.signStore.uuid) { - this.signStore.uuid = this.$route.params.uuid + if (this.signStore.document.uuid.length === 0) { + this.signStore.initFromState() + if (!this.signStore.document.uuid) { + this.signStore.document.uuid = this.$route.params.uuid + } } + this.mounted = true showErrors(this.signStore.errors) }, methods: {