diff options
| author | tgloeggl <tgloeggl@uos.de> | 2022-01-13 14:38:39 +0100 |
|---|---|---|
| committer | tgloeggl <tgloeggl@uos.de> | 2022-07-28 13:59:21 +0200 |
| commit | da3db0c846bd2c3498a487727ddb11b37324824f (patch) | |
| tree | 4b0b13adb6a1f55716372b75887e139d7f94df85 /resources/vue/store | |
| parent | 7d087fcdf3218f8101e592b78f948479b3d02fe2 (diff) | |
working on creating plugin-api for im- and exportticket-334
fix bug
fix passing of custom file to block
fix custom-file creation on client side
working on crud custom file api for courseware blocks
create correct link for custom file
add read part of CRUD
add delete part of CRUD
change behaviour of add a new file, contents are passed via separate route
update custom-file content
add route to patch metadata of custom-file
changes to export for reference
fix jsonapi for custom-files
export custom-files
correctly import custom files
remove custom files from file-refs
revert changes to block
remove obsolte use statement in Block
revert changes to BlockType and Download-Block
remove obsolete implements from DownloadBlock
add doku, fix exporting of blocks without custom-files
remove debugging messages and now obsolete code
cleaning up
rework custom file check
fix error and remove call to mime-type for custom files
rename interface methods
do not assign variables in function calls
Diffstat (limited to 'resources/vue/store')
| -rw-r--r-- | resources/vue/store/courseware/courseware.module.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/resources/vue/store/courseware/courseware.module.js b/resources/vue/store/courseware/courseware.module.js index 49ac520..59a94a7 100644 --- a/resources/vue/store/courseware/courseware.module.js +++ b/resources/vue/store/courseware/courseware.module.js @@ -305,6 +305,42 @@ export const actions = { }); }, + async createCustomFile(context, { file, filedata, block_id }) { + // create custom file for block + let url = `courseware-blocks/${block_id}/custom-files`; + let newFile = await state.httpClient.post(url, file). + then(({data }) => { + return data.data; + }); + + // set file data with separate call + let formData = new FormData(); + formData.append('file', filedata, newFile.id); + + url = `courseware-blocks/${block_id}/custom-files/${newFile.id}`; + + await state.httpClient.post(url, formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); + + return newFile; + }, + + async loadCustomFiles(context, block_id) { + const parent = { + type: 'courseware-blocks', + id: block_id, + }; + + const url = `courseware-blocks/${block_id}/custom-files` + return state.httpClient.get(url) + .then(({ data }) => { + return data.data; + }); + }, + async createRootFolder({ dispatch, rootGetters }, { context, folder }) { // get root folder for this context await dispatch( |
