get list http

This commit is contained in:
MDeghaud67 2023-04-18 14:37:20 +02:00
parent a38b5d057a
commit 6df08b7283
3 changed files with 54 additions and 0 deletions

18
IOT/src/data/listData.js Normal file
View File

@ -0,0 +1,18 @@
import PocketBase from 'pocketbase';
const pb = new PocketBase('https://iot.epi.cb85.software');
// fetch a paginated records list
const resultList = await pb.collection('data').getList(1, 50, {
filter: 'created >= "2022-01-01 00:00:00" && someField1 != someField2',
});
// you can also fetch all records at once via getFullList
const records = await pb.collection('data').getFullList(200 /* batch size */, {
sort: '-created',
});
// or fetch only the first record that matches the specified filter
const record = await pb.collection('data').getFirstListItem('someField="test"', {
expand: 'relField1,relField2.subRelField',
});

View File

@ -0,0 +1,18 @@
import PocketBase from 'pocketbase';
const pb = new PocketBase('https://iot.epi.cb85.software');
// fetch a paginated records list
const resultList = await pb.collection('trashs').getList(1, 50, {
filter: 'created >= "2022-01-01 00:00:00" && someField1 != someField2',
});
// you can also fetch all records at once via getFullList
const records = await pb.collection('trashs').getFullList(200 /* batch size */, {
sort: '-created',
});
// or fetch only the first record that matches the specified filter
const record = await pb.collection('trashs').getFirstListItem('someField="test"', {
expand: 'relField1,relField2.subRelField',
});

View File

@ -0,0 +1,18 @@
import PocketBase from 'pocketbase';
const pb = new PocketBase('https://iot.epi.cb85.software');
// fetch a paginated records list
const resultList = await pb.collection('users').getList(1, 50, {
filter: 'created >= "2022-01-01 00:00:00" && someField1 != someField2',
});
// you can also fetch all records at once via getFullList
const records = await pb.collection('users').getFullList(200 /* batch size */, {
sort: '-created',
});
// or fetch only the first record that matches the specified filter
const record = await pb.collection('users').getFirstListItem('someField="test"', {
expand: 'relField1,relField2.subRelField',
});