Skip to content

Commit f4492f4

Browse files
authored
fix(minor): api and crypto related bugs (#676)
* fix: using uncrypto * feat: changeset
1 parent 5343930 commit f4492f4

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

.changeset/violet-cycles-mate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"enspire": patch
3+
---
4+
5+
bugfixes

app/components/custom/club-file-upload.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ async function download() {
132132
// window.open(data)
133133
downloadLink.value = data.url
134134
downloadFilename.value = data.name
135-
dlink.value.click()
135+
nextTick(() => {
136+
dlink.value.click()
137+
})
136138
downloading.value = false
137139
}
138140
}

plugins/crypto.server.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// TODO: this is a temporary solution to the error
2+
// of occurrence of 'crypto not defined' in prod
3+
4+
export default defineNuxtPlugin(() => {
5+
const crypto = require('uncrypto')
6+
global.crypto = crypto
7+
})

server/api/files/newRecord.post.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PrismaClient } from '@prisma/client'
2-
import { v4 as uuidv4 } from 'uuid'
2+
import { randomUUID } from 'uncrypto'
33

44
const prisma = new PrismaClient()
55

@@ -75,7 +75,7 @@ export default eventHandler(async (event) => {
7575
}
7676
}
7777
catch (error) {
78-
const fileUUID = uuidv4()
78+
const fileUUID = randomUUID()
7979
try {
8080
await prisma.fileUploadRecord.create({
8181
data: {

0 commit comments

Comments
 (0)