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

33 lines
665 B
TypeScript
Raw Normal View History

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