File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,10 +34,10 @@ export default {
3434 }
3535 },
3636 methods: {
37- checkAndLoadPendingEnvelope () {
37+ async checkAndLoadPendingEnvelope () {
3838 const pendingEnvelope = window .OCA ? .Libresign ? .pendingEnvelope
3939 if (pendingEnvelope? .id ) {
40- this .filesStore .addFile (pendingEnvelope)
40+ await this .filesStore .addFile (pendingEnvelope)
4141 this .filesStore .selectFile (pendingEnvelope .id )
4242 delete window .OCA .Libresign .pendingEnvelope
4343
@@ -87,7 +87,7 @@ export default {
8787 },
8888
8989 async update (fileInfo ) {
90- if (this .checkAndLoadPendingEnvelope ()) {
90+ if (await this .checkAndLoadPendingEnvelope ()) {
9191 return
9292 }
9393
@@ -97,7 +97,7 @@ export default {
9797 return
9898 }
9999
100- this .filesStore .addFile ({
100+ await this .filesStore .addFile ({
101101 nodeId: fileInfo .id ,
102102 name: fileInfo .name ,
103103 file: generateRemoteUrl (` dav/files/${ getCurrentUser ()? .uid }/ ${fileInfo .path + ' /' + fileInfo .name }` )
Original file line number Diff line number Diff line change @@ -50,8 +50,10 @@ export const useFilesStore = function(...args) {
5050 ? { file_id : file . id , force_fetch : true }
5151 : { 'nodeIds[]' : [ nodeId ] , force_fetch : true }
5252
53+ const savedSelectedNodeId = this . selectedNodeId
5354 const fetchedFiles = await this . getAllFiles ( filter )
5455 fileData = fetchedFiles [ nodeId ] || { ...file , signers : [ ] }
56+ this . selectedNodeId = savedSelectedNodeId
5557 }
5658
5759 if ( fileData . signers ) {
@@ -531,9 +533,13 @@ export const useFilesStore = function(...args) {
531533
532534 if ( uuid || file . uuid ) {
533535 config . data . uuid = uuid || file . uuid
534- } else {
536+ } else if ( file . id ) {
537+ config . data . file = {
538+ fileId : file . id ,
539+ }
540+ } else if ( file . nodeId ) {
535541 config . data . file = {
536- fileId : fileId || this . getFile ( ) . id ,
542+ nodeId : file . nodeId ,
537543 }
538544 }
539545
@@ -571,9 +577,13 @@ export const useFilesStore = function(...args) {
571577
572578 if ( uuid || file . uuid ) {
573579 config . data . uuid = uuid || file . uuid
574- } else {
580+ } else if ( file . id ) {
581+ config . data . file = {
582+ fileId : file . id ,
583+ }
584+ } else if ( file . nodeId ) {
575585 config . data . file = {
576- fileId : fileId || this . getFile ( ) . id ,
586+ nodeId : file . nodeId ,
577587 }
578588 }
579589 const { data } = await axios ( config )
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export const useSignStore = defineStore('sign', {
3333 state : ( ) => ( { ...defaultState } ) ,
3434
3535 actions : {
36- initFromState ( ) {
36+ async initFromState ( ) {
3737 this . errors = loadState ( 'libresign' , 'errors' , [ ] )
3838
3939 const file = {
@@ -50,7 +50,7 @@ export const useSignStore = defineStore('sign', {
5050 }
5151 this . setFileToSign ( file )
5252 const filesStore = useFilesStore ( )
53- filesStore . addFile ( file )
53+ await filesStore . addFile ( file )
5454 filesStore . selectedNodeId = file . nodeId
5555 } ,
5656 setFileToSign ( file ) {
You can’t perform that action at this time.
0 commit comments