2020-06-11 19:27:21 +02:00
|
|
|
import AbstractService from './abstractService'
|
|
|
|
import ListModel from '../models/list'
|
|
|
|
|
|
|
|
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 listId
|
|
|
|
* @param file
|
|
|
|
* @returns {Promise<any|never>}
|
|
|
|
*/
|
|
|
|
create(listId, file) {
|
2020-08-02 19:17:29 +02:00
|
|
|
return this.uploadFile(
|
2020-06-11 19:27:21 +02:00
|
|
|
this.getReplacedRoute(this.paths.create, {listId: 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
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|