frontend-taskdone/src/services/notification.js
konrad c076298cf0 Add notifications overview (#414)
Co-authored-by: kolaente <k@knt.li>
Reviewed-on: vikunja/frontend#414
Co-authored-by: konrad <konrad@kola-entertainments.de>
Co-committed-by: konrad <konrad@kola-entertainments.de>
2021-02-21 15:13:58 +00:00

22 lines
522 B
JavaScript

import AbstractService from '@/services/abstractService'
import {formatISO} from 'date-fns'
import NotificationModel from '@/models/notification'
export default class NotificationService extends AbstractService {
constructor() {
super({
getAll: '/notifications',
update: '/notifications/{id}',
})
}
modelFactory(data) {
return new NotificationModel(data)
}
beforeUpdate(model) {
model.created = formatISO(new Date(model.created))
model.readAt = formatISO(new Date(model.readAt))
return model
}
}