vikunja-frontend/src/services/backgroundUpload.ts

33 lines
662 B
TypeScript
Raw Normal View History

import AbstractService from './abstractService'
2022-07-21 00:42:36 +02:00
import ListModel, { type IList } from '../models/list'
import type { IFile } from '@/models/file'
export default class BackgroundUploadService extends AbstractService {
constructor() {
super({
create: '/lists/{listId}/backgrounds/upload',
})
}
useCreateInterceptor() {
return false
}
modelCreateFactory(data) {
return new ListModel(data)
}
/**
* Uploads a file to the server
* @param file
* @returns {Promise<any|never>}
*/
2022-07-21 00:42:36 +02:00
create(listId: IList['id'], file: IFile) {
return this.uploadFile(
2022-06-23 03:20:07 +02:00
this.getReplacedRoute(this.paths.create, {listId}),
file,
'background',
)
}
}