get list http
This commit is contained in:
parent
a38b5d057a
commit
6df08b7283
18
IOT/src/data/listData.js
Normal file
18
IOT/src/data/listData.js
Normal 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',
|
||||||
|
});
|
18
IOT/src/trashs/listTrashs.js
Normal file
18
IOT/src/trashs/listTrashs.js
Normal 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',
|
||||||
|
});
|
18
IOT/src/users/listUsers.js
Normal file
18
IOT/src/users/listUsers.js
Normal 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',
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user