bigbuffet-rw/app/soapbox/normalizers/chat.ts

18 lines
452 B
TypeScript
Raw Normal View History

import { Map as ImmutableMap, Record as ImmutableRecord, fromJS } from 'immutable';
import type { Account, EmbeddedEntity } from 'soapbox/types/entities';
export const ChatRecord = ImmutableRecord({
2023-06-20 12:24:39 -07:00
account: null as EmbeddedEntity<Account>,
id: '',
unread: 0,
last_message: '' as string || null,
2022-09-21 15:52:20 -07:00
updated_at: '',
});
export const normalizeChat = (chat: Record<string, any>) => {
return ChatRecord(
ImmutableMap(fromJS(chat)),
);
};