feat: feat-attachments-script-setup (#2358)
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2358 Reviewed-by: konrad <k@knt.li> Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de> Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:

committed by
konrad

parent
13bc25ff5d
commit
4dfcd8e70f
@ -4,7 +4,6 @@ import AbstractService from './abstractService'
|
||||
import AttachmentModel from '../models/attachment'
|
||||
|
||||
import type { IAttachment } from '@/modelTypes/IAttachment'
|
||||
import type { IFile } from '@/modelTypes/IFile'
|
||||
|
||||
import {downloadBlob} from '@/helpers/downloadBlob'
|
||||
|
||||
@ -18,8 +17,10 @@ export default class AttachmentService extends AbstractService<AttachmentModel>
|
||||
}
|
||||
|
||||
processModel(model: IAttachment) {
|
||||
model.created = formatISO(new Date(model.created))
|
||||
return model
|
||||
return {
|
||||
...model,
|
||||
created: formatISO(new Date(model.created)),
|
||||
}
|
||||
}
|
||||
|
||||
useCreateInterceptor() {
|
||||
@ -52,7 +53,7 @@ export default class AttachmentService extends AbstractService<AttachmentModel>
|
||||
* @param files
|
||||
* @returns {Promise<any|never>}
|
||||
*/
|
||||
create(model: IAttachment, files: IFile[]) {
|
||||
create(model: IAttachment, files: File[] | FileList) {
|
||||
const data = new FormData()
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
// TODO: Validation of file size
|
||||
|
Reference in New Issue
Block a user