* fix: Notification filters * Update notification_finder.rb * Update notification_finder.rb * Update notification_finder.rb * fix: spec * fix: specs * Update notification_finder.rb * fix: add more fixes * Update notification_finder.rb * fix: specs * chore: better comments * chore: removed filtering * chore: refactoring * fix: review fixes * fix: API call * chore: Minor fix * Rename spec * Fix params getting undefined * Fix finder --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: iamsivin <iamsivin@gmail.com> Co-authored-by: Pranav <pranav@chatwoot.com>
25 lines
694 B
JavaScript
25 lines
694 B
JavaScript
import { sortComparator } from './helpers';
|
|
|
|
export const getters = {
|
|
getNotifications($state) {
|
|
return Object.values($state.records).sort((n1, n2) => n2.id - n1.id);
|
|
},
|
|
getFilteredNotifications: $state => filters => {
|
|
const sortOrder = filters.sortOrder === 'desc' ? 'newest' : 'oldest';
|
|
const sortedNotifications = Object.values($state.records).sort((n1, n2) =>
|
|
sortComparator(n1, n2, sortOrder)
|
|
);
|
|
return sortedNotifications;
|
|
},
|
|
getUIFlags($state) {
|
|
return $state.uiFlags;
|
|
},
|
|
getNotification: $state => id => {
|
|
const notification = $state.records[id];
|
|
return notification || {};
|
|
},
|
|
getMeta: $state => {
|
|
return $state.meta;
|
|
},
|
|
};
|