feat(nui): WIP manual pagination

This commit is contained in:
Luke committed 2022-01-04 18:36:52 +01:00
1 parent 3a1462e0c0
commit 7560099231
8 files changed
+67 -57

No files matched your search

+6 -4
View File
@@ -48,12 +48,14 @@ RegisterCommand(
true
);
onNet(`oxmysql:fetchResource`, (resource: string) => {
if (typeof resource !== 'string') return;
onNet(`oxmysql:fetchResource`, (data: {resource: string, pageIndex: number}) => {
if (typeof data.resource !== 'string') return;
const queries = logStorage[resource];
const queries = logStorage[data.resource].slice(data.pageIndex * 12, data.pageIndex + 12)
const pageCount = Math.ceil(logStorage[data.resource].length / 12)
if (!queries) return;
emitNet(`oxmysql:loadResource`, source, queries);
emitNet(`oxmysql:loadResource`, source, {queries, pageCount});
});