vikunja-frontend/src/services/teamList.js
konrad 4a413e7f3c Make all api fields snake_case (#105)
Change all snake/camelCase mix and match to camelCase everywhere

Fix conversion to not interfer with service interceptors

Add dynamic conversion between camelCase and snake_case to services

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/105
2020-04-12 21:54:46 +00:00

29 lines
No EOL
679 B
JavaScript

import AbstractService from './abstractService'
import TeamListModel from '../models/teamList'
import TeamModel from '../models/team'
import {formatISO} from 'date-fns'
export default class TeamListService extends AbstractService {
constructor() {
super({
create: '/lists/{listId}/teams',
getAll: '/lists/{listId}/teams',
update: '/lists/{listId}/teams/{teamId}',
delete: '/lists/{listId}/teams/{teamId}',
})
}
processModel(model) {
model.created = formatISO(model.created)
model.updated = formatISO(model.updated)
return model
}
modelFactory(data) {
return new TeamListModel(data)
}
modelGetAllFactory(data) {
return new TeamModel(data)
}
}