Skip to content

Instantly share code, notes, and snippets.

@daniilgrigoryev
Last active May 14, 2021 14:32
Show Gist options
  • Select an option

  • Save daniilgrigoryev/5c50e15d0e3806d1bcd46ceff527c9a1 to your computer and use it in GitHub Desktop.

Select an option

Save daniilgrigoryev/5c50e15d0e3806d1bcd46ceff527c9a1 to your computer and use it in GitHub Desktop.
Promises.All rejecting
async getSig(fileSystem, fileID) {
try {
const fileBase = await $axios.get(`/api/v2/application/doc-for-sign/${fileSystem}/${fileID}`)
// const signFile = await this.$createAttachedSignature(this.thumbprint, fileBase.data.file, true)
// const uploadSign = await this.uploadSign(fileID, fileSystem, signFile)
// console.log(fileBase.status || 'error');
// console.log(fileBase);
// signFile && (this.countSignDocuments += 1)
} catch (error) {
throw new Error(error)
}
},
async signFiles() {
try {
await this.initCryptoThumbprint()
for (let [fileSystem] of Object.entries(this.documents)) {
let fileGroup = this.documents[fileSystem]
!!fileGroup.length &&
(await Promise.all(
fileGroup.map(async (fileID) => {
await this.getSig(fileSystem, fileID)
})
))
}
} catch (error) {
let errorMessage = error.message || `Возникла проблема во время подписания документов`
this.$emit('dialog', false)
this.pushSnackbar(true, 'red', errorMessage)
throw new Error(errorMessage)
}
},
let documents = {
file_storage: ["47643069"],
file_managed: [
"47642988",
"47642987",
"47642989",
"47643069",
"47643070",
"47643068",
"47643072",
"47643014",
"47643016",
"47643015",
"47642986",
"47642936",
"47643011",
"47642985",
"17819751",
"47642937",
"47642940",
"47642983",
"47642984",
"17819750",
"47642939",
"47643017",
"47643066",
"47643067",
"47643065",
"47643021",
"47643022",
"47643024",
"47643023",
"47643025",
"47643026",
"47643027",
"47643012",
"47643013",
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment