vikunja-frontend/src/services/caldavToken.ts
Dominik Pschenitschni 1a11b43ca8 feat: improve models
2022-09-13 14:59:02 +00:00

26 lines
No EOL
633 B
TypeScript

import {formatISO} from 'date-fns'
import CaldavTokenModel from '@/models/caldavToken'
import type {ICaldavToken} from '@/modelTypes/ICaldavToken'
import AbstractService from './abstractService'
export default class CaldavTokenService extends AbstractService<ICaldavToken> {
constructor() {
super({
getAll: '/user/settings/token/caldav',
create: '/user/settings/token/caldav',
delete: '/user/settings/token/caldav/{id}',
})
}
processModel(model: Partial<ICaldavToken>) {
return {
...model,
created: formatISO(new Date(model.created)),
}
}
modelFactory(data) {
return new CaldavTokenModel(data)
}
}