Skip to content
Snippets Groups Projects
Commit c1544eed authored by B. Sc Pius Gyamenah's avatar B. Sc Pius Gyamenah :speech_balloon: Committed by Ron Lucke
Browse files

Biest #1259

Closes #1259 and #1058

Merge request studip/studip!1053
parent 2167eb75
No related branches found
No related tags found
No related merge requests found
...@@ -314,13 +314,12 @@ export const actions = { ...@@ -314,13 +314,12 @@ export const actions = {
}, },
async createFile(context, { file, filedata, folder }) { async createFile(context, { file, filedata, folder }) {
const termId = file.relationships['terms-of-use'].data.id; const termId = file?.relationships['terms-of-use']?.data?.id ?? null;
const formData = new FormData(); const formData = new FormData();
formData.append('file', filedata, file.attributes.name); formData.append('file', filedata, file.attributes.name);
if (termId) { if (termId) {
formData.append('term-id', termId); formData.append('term-id', termId);
} }
const url = `folders/${folder.id}/file-refs`; const url = `folders/${folder.id}/file-refs`;
let request = await state.httpClient.post(url, formData, { let request = await state.httpClient.post(url, formData, {
headers: { headers: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment