From cee338f18d22bbbb989d79c0add082fdb4e2b8ef Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 08 Sep 2023 11:09:00 +0800
Subject: [PATCH] store添加projectId
---
src/api/media.ts | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/api/media.ts b/src/api/media.ts
index 9cf48d9..634bd13 100644
--- a/src/api/media.ts
+++ b/src/api/media.ts
@@ -1,3 +1,4 @@
+import { message } from 'ant-design-vue'
import request, { IPage, IWorkspaceResponse } from '/@/api/http/request'
const HTTP_PREFIX = '/media/api/v1'
@@ -8,11 +9,18 @@
return result.data
}
// Download Media File
-export const downloadMediaFile = async function (workspaceId: string, fingerprint: string): Promise<any> {
- const url = `${HTTP_PREFIX}/files/${workspaceId}/file/${fingerprint}/url`
+export const downloadMediaFile = async function (workspaceId: string, fileId: string): Promise<any> {
+ const url = `${HTTP_PREFIX}/files/${workspaceId}/file/${fileId}/url`
const result = await request.get(url, { responseType: 'blob' })
- if (result.data.code) {
+ if (result.data.type === 'application/json') {
+ const reader = new FileReader()
+ reader.onload = function (e) {
+ const text = reader.result as string
+ const result = JSON.parse(text)
+ message.error(result.message)
+ }
+ reader.readAsText(result.data, 'utf-8')
+ } else {
return result.data
}
- return result
}
--
Gitblit v1.9.3