diff --git a/.changeset/violet-cycles-mate.md b/.changeset/violet-cycles-mate.md new file mode 100644 index 00000000..cb84ccbc --- /dev/null +++ b/.changeset/violet-cycles-mate.md @@ -0,0 +1,5 @@ +--- +"enspire": patch +--- + +bugfixes diff --git a/app/components/custom/club-file-upload.vue b/app/components/custom/club-file-upload.vue index 992030dd..da9d37af 100644 --- a/app/components/custom/club-file-upload.vue +++ b/app/components/custom/club-file-upload.vue @@ -130,7 +130,9 @@ async function download() { // window.open(data) downloadLink.value = data.url downloadFilename.value = data.name - dlink.value.click() + nextTick(() => { + dlink.value.click() + }) downloading.value = false } downloadLink.value = '' diff --git a/plugins/crypto.server.ts b/plugins/crypto.server.ts new file mode 100644 index 00000000..4d907f43 --- /dev/null +++ b/plugins/crypto.server.ts @@ -0,0 +1,7 @@ +// TODO: this is a temporary solution to the error +// of occurrence of 'crypto not defined' in prod + +export default defineNuxtPlugin(() => { + const crypto = require('uncrypto') + global.crypto = crypto +}) diff --git a/server/api/files/newRecord.post.ts b/server/api/files/newRecord.post.ts index a445f0ec..aac3645f 100644 --- a/server/api/files/newRecord.post.ts +++ b/server/api/files/newRecord.post.ts @@ -1,5 +1,5 @@ import { PrismaClient } from '@prisma/client' -import { v4 as uuidv4 } from 'uuid' +import { randomUUID } from 'uncrypto' const prisma = new PrismaClient() @@ -75,7 +75,7 @@ export default eventHandler(async (event) => { } } catch (error) { - const fileUUID = uuidv4() + const fileUUID = randomUUID() try { await prisma.fileUploadRecord.create({ data: {