Новые правки
This commit is contained in:
parent
79db7c8563
commit
a5f208a132
19 changed files with 852 additions and 1 deletions
37
frontend/scripts/debug-post.ts
Normal file
37
frontend/scripts/debug-post.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import PocketBase from 'pocketbase';
|
||||
|
||||
const REMOTE_PB_URL = 'https://avt-back.ru';
|
||||
const remotePb = new PocketBase(REMOTE_PB_URL);
|
||||
|
||||
// Try to get an auth token
|
||||
async function main() {
|
||||
console.log('Testing auth...\n');
|
||||
|
||||
// Try user auth
|
||||
try {
|
||||
await remotePb.collection('users').authWithPassword('redibedi2019@gmail.com', 'Stalin4444');
|
||||
console.log('User auth: Success');
|
||||
console.log('Token:', remotePb.authStore.token?.substring(0, 20) + '...');
|
||||
} catch (e: any) {
|
||||
console.log('User auth failed:', e.message);
|
||||
}
|
||||
|
||||
// Check auth state
|
||||
console.log('\nAuth state:');
|
||||
console.log(' isValid:', remotePb.authStore.isValid);
|
||||
console.log(' token exists:', !!remotePb.authStore.token);
|
||||
|
||||
if (remotePb.authStore.isValid) {
|
||||
// Try update now
|
||||
try {
|
||||
await remotePb.collection('posts').update('e8or2rfsrpoly19', {
|
||||
description: 'Test update'
|
||||
});
|
||||
console.log('\nUpdate after auth: Success!');
|
||||
} catch (e: any) {
|
||||
console.log('\nUpdate after auth:', e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Loading…
Add table
Add a link
Reference in a new issue