File size: 496 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// @flow
import { createReadQuery, db } from 'shared/db';
import type { DBChannel } from 'shared/types';
export const getChannelById = createReadQuery((id: string) => ({
query: db.table('channels').get(id),
tags: (channel: ?DBChannel) => (channel ? [channel.id] : []),
}));
export const getChannelsById = createReadQuery((ids: Array<string>) => ({
query: db.table('channels').getAll(...ids),
tags: (channels: ?Array<DBChannel>) =>
channels ? channels.map(({ id }) => id) : [],
}));
|