Skip to content

Commit

Permalink
feat: add post process function after documents list fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelinz authored and czosel committed Sep 6, 2023
1 parent 090c10f commit eafff12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addon/components/document-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default class DocumentViewComponent extends Component {
@service intl;
@service documents;
@service router;
@service config;

@tracked isDragOver = false;
@tracked dragCounter = 0;
Expand Down Expand Up @@ -50,11 +51,13 @@ export default class DocumentViewComponent extends Component {
@lastValue("fetchDocuments") fetchedDocuments;
@task
*fetchDocuments() {
return yield this.store.query("document", {
const documents = yield this.store.query("document", {
include: "category,files,tags",
filter: this.args.filters || {},
sort: this.sort ? `${this.sortDirection}${this.sort}` : "",
});

return yield this.config.documentsPostProcess(documents);
}

@task
Expand Down
4 changes: 4 additions & 0 deletions addon/services/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ export default class ConfigService extends Service {
resolveGroup(id) {
return id;
}

documentsPostProcess(documents) {
return documents;
}
}

0 comments on commit eafff12

Please sign in to comment.