pass space for upload

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-08-30 19:09:31 +02:00
parent d0c53e9437
commit 4e4b5ba5ab
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
2 changed files with 4 additions and 4 deletions

View File

@ -61,7 +61,7 @@
loading = true
try {
resumeId = generateId()
resumeUuid = await uploadFile(resumeId, file)
resumeUuid = await uploadFile(resumeId, space, file)
resumeName = file.name
resumeSize = file.size
resumeType = file.type

View File

@ -14,19 +14,19 @@
// limitations under the License.
//
import type { Ref, Doc } from '@anticrm/core'
import type { Ref, Doc, Space } from '@anticrm/core'
import { getMetadata } from '@anticrm/platform'
import login from '@anticrm/login'
export async function uploadFile(id: Ref<Doc>, file: File): Promise<string> {
export async function uploadFile(id: Ref<Doc>, space: Ref<Space>, file: File): Promise<string> {
console.log(file)
const uploadUrl = getMetadata(login.metadata.UploadUrl)
const data = new FormData()
data.append('file', file)
const url = `${uploadUrl}?id=${id}&space=space`
const url = `${uploadUrl}?id=${id}&space=${space}`
const resp = await fetch(url, {
method: 'POST',
headers: {