feat: Aggiunto metodo separato per la query

This commit is contained in:
Maicol Battistini 2023-06-07 17:28:38 +02:00
parent 6a49bb0012
commit 207f4f3841
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import {mdiChevronLeft} from '@mdi/js';
import MdIcon from '@osm/Components/MdIcon';
import Page, {PageAttributes} from '@osm/Components/Page';
import Model from '@osm/Models/Model';
import {Builder} from 'coloquent';
import {
Children,
Vnode,
@ -35,7 +36,7 @@ export default abstract class RecordPage<M extends Model<any, any>, A extends Re
async loadRecord(recordId?: number | string) {
if (recordId) {
const response = await this.recordType.find(recordId);
const response = await this.modelQuery().find(recordId);
this.record = response.getData() || undefined;
}
@ -47,6 +48,10 @@ export default abstract class RecordPage<M extends Model<any, any>, A extends Re
m.redraw();
}
modelQuery(): Builder<M> {
return this.recordType.query();
}
contents(vnode: Vnode<A>): Children {
return this.backButton(vnode);
}