Working recently edited list
This commit is contained in:
@@ -96,7 +96,7 @@ class CollectionsStore {
|
||||
const res = await this.client.post('/collections.list');
|
||||
invariant(res && res.data, 'Collection list not available');
|
||||
const { data } = res;
|
||||
runInAction('CollectionsStore#fetch', () => {
|
||||
runInAction('CollectionsStore#fetchAll', () => {
|
||||
data.forEach(collection => {
|
||||
this.data.set(collection.id, new Collection(collection));
|
||||
});
|
||||
|
||||
@@ -52,6 +52,17 @@ class DocumentsStore extends BaseStore {
|
||||
return _.take(_.orderBy(this.data.values(), 'updatedAt', 'desc'), 5);
|
||||
}
|
||||
|
||||
recentlyEditedInCollection(collectionId: string): Array<Document> {
|
||||
return _.orderBy(
|
||||
_.filter(
|
||||
this.data.values(),
|
||||
document => document.collectionId === collectionId
|
||||
),
|
||||
'updatedAt',
|
||||
'desc'
|
||||
);
|
||||
}
|
||||
|
||||
@computed
|
||||
get starred(): Array<Document> {
|
||||
return _.filter(this.data.values(), 'starred');
|
||||
|
||||
Reference in New Issue
Block a user