This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/services/backgroundUpload.ts

32 lines
619 B
TypeScript

import AbstractService from './abstractService'
import ListModel from '@/models/list'
import type {IList} from '@/modelTypes/IList'
export default class BackgroundUploadService extends AbstractService<IList> {
constructor() {
super({
create: '/lists/{listId}/backgrounds/upload',
})
}
useCreateInterceptor() {
return false
}
modelCreateFactory(data: Partial<IList>) {
return new ListModel(data)
}
/**
* Uploads a file to the server
*/
create(listId: IList['id'], file: File) {
return this.uploadFile(
this.getReplacedRoute(this.paths.create, {listId}),
file,
'background',
)
}
}