diff --git a/.history/IOT/src/users/login_20230418170045.js b/.history/IOT/src/users/login_20230418170045.js new file mode 100644 index 0000000..e69de29 diff --git a/.history/IOT/src/users/login_20230418170119.js b/.history/IOT/src/users/login_20230418170119.js new file mode 100644 index 0000000..4a8b83d --- /dev/null +++ b/.history/IOT/src/users/login_20230418170119.js @@ -0,0 +1,16 @@ +import PocketBase from 'pocketbase'; + +const pb = new PocketBase('https://iot.epi.cb85.software'); + +const authData = await pb.collection('users').authWithPassword( + 'YOUR_USERNAME_OR_EMAIL', + 'YOUR_PASSWORD', +); + +// after the above you can also access the auth data from the authStore +console.log(pb.authStore.isValid); +console.log(pb.authStore.token); +console.log(pb.authStore.model.id); + +// "logout" the last authenticated account +pb.authStore.clear(); \ No newline at end of file diff --git a/IOT/src/users/login.js b/IOT/src/users/login.js new file mode 100644 index 0000000..4a8b83d --- /dev/null +++ b/IOT/src/users/login.js @@ -0,0 +1,16 @@ +import PocketBase from 'pocketbase'; + +const pb = new PocketBase('https://iot.epi.cb85.software'); + +const authData = await pb.collection('users').authWithPassword( + 'YOUR_USERNAME_OR_EMAIL', + 'YOUR_PASSWORD', +); + +// after the above you can also access the auth data from the authStore +console.log(pb.authStore.isValid); +console.log(pb.authStore.token); +console.log(pb.authStore.model.id); + +// "logout" the last authenticated account +pb.authStore.clear(); \ No newline at end of file