2020-06-11 19:27:21 +02:00
|
|
|
import AbstractService from './abstractService'
|
2022-09-06 11:36:01 +02:00
|
|
|
import ListModel from '@/models/list'
|
|
|
|
|
|
|
|
import type { IList } from '@/modelTypes/IList'
|
|
|
|
import type { IFile } from '@/modelTypes/IFile'
|
2020-06-11 19:27:21 +02:00
|
|
|
|
|
|
|
export default class BackgroundUploadService extends AbstractService {
|
|
|
|
constructor() {
|
|
|
|
super({
|
|
|
|
create: '/lists/{listId}/backgrounds/upload',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
useCreateInterceptor() {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-09-06 11:36:01 +02:00
|
|
|
modelCreateFactory(data: Partial<IList>) {
|
2020-06-11 19:27:21 +02:00
|
|
|
return new ListModel(data)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Uploads a file to the server
|
|
|
|
*/
|
2022-07-21 00:42:36 +02:00
|
|
|
create(listId: IList['id'], file: IFile) {
|
2020-08-02 19:17:29 +02:00
|
|
|
return this.uploadFile(
|
2022-06-23 03:20:07 +02:00
|
|
|
this.getReplacedRoute(this.paths.create, {listId}),
|
2020-08-02 19:17:29 +02:00
|
|
|
file,
|
2020-09-05 22:35:52 +02:00
|
|
|
'background',
|
2020-06-11 19:27:21 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|