auth with admin
This commit is contained in:
parent
824276bc07
commit
bccceafeec
7
.history/IOT/src/admin/getOneAdmin_20230424110405.js
Normal file
7
.history/IOT/src/admin/getOneAdmin_20230424110405.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
const pb = new PocketBase('http://127.0.0.1:8090');
|
||||||
|
|
||||||
|
await pb.admins.authWithPassword('test@example.com', '123456');
|
||||||
|
|
||||||
|
const admin = await pb.admins.getOne('ADMIN_ID');
|
18
.history/IOT/src/admin/listAdmins_20230424110219.js
Normal file
18
.history/IOT/src/admin/listAdmins_20230424110219.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
const pb = new PocketBase('http://127.0.0.1:8090');
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
await pb.admins.authWithPassword('test@example.com', '123456');
|
||||||
|
|
||||||
|
// fetch a paginated records list
|
||||||
|
const resultList = await pb.admins.getList(1, 100, {
|
||||||
|
filter: 'created >= '2022-01-01 00:00:00'',
|
||||||
|
});
|
||||||
|
|
||||||
|
// you can also fetch all records at once via getFullList
|
||||||
|
const admins = await pb.admins.getFullList({ sort: '-created' });
|
||||||
|
|
||||||
|
// or fetch only the first admin that matches the specified filter
|
||||||
|
const admin = await pb.admins.getFirstListItem('email~"test"');
|
16
.history/IOT/src/admin/listAdmins_20230424110316.js
Normal file
16
.history/IOT/src/admin/listAdmins_20230424110316.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
const pb = new PocketBase('http://127.0.0.1:8090');
|
||||||
|
|
||||||
|
await pb.admins.authWithPassword('test@example.com', '123456');
|
||||||
|
|
||||||
|
// fetch a paginated records list
|
||||||
|
const resultList = await pb.admins.getList(1, 100, {
|
||||||
|
filter: 'created >= \'2022-01-01 00:00:00\'',
|
||||||
|
});
|
||||||
|
|
||||||
|
// you can also fetch all records at once via getFullList
|
||||||
|
const admins = await pb.admins.getFullList({ sort: '-created' });
|
||||||
|
|
||||||
|
// or fetch only the first admin that matches the specified filter
|
||||||
|
const admin = await pb.admins.getFirstListItem('email~"test"');
|
7
IOT/src/admin/getOneAdmin.js
Normal file
7
IOT/src/admin/getOneAdmin.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
const pb = new PocketBase('http://127.0.0.1:8090');
|
||||||
|
|
||||||
|
await pb.admins.authWithPassword('test@example.com', '123456');
|
||||||
|
|
||||||
|
const admin = await pb.admins.getOne('ADMIN_ID');
|
16
IOT/src/admin/listAdmins.js
Normal file
16
IOT/src/admin/listAdmins.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
const pb = new PocketBase('http://127.0.0.1:8090');
|
||||||
|
|
||||||
|
await pb.admins.authWithPassword('test@example.com', '123456');
|
||||||
|
|
||||||
|
// fetch a paginated records list
|
||||||
|
const resultList = await pb.admins.getList(1, 100, {
|
||||||
|
filter: 'created >= \'2022-01-01 00:00:00\'',
|
||||||
|
});
|
||||||
|
|
||||||
|
// you can also fetch all records at once via getFullList
|
||||||
|
const admins = await pb.admins.getFullList({ sort: '-created' });
|
||||||
|
|
||||||
|
// or fetch only the first admin that matches the specified filter
|
||||||
|
const admin = await pb.admins.getFirstListItem('email~"test"');
|
Loading…
x
Reference in New Issue
Block a user