import PocketBase from 'pocketbase';

const db_url = import.meta.env.PROD ? '/' : 'http://localhost:8090';
console.log(import.meta.env.PROD, db_url);

export const pb = new PocketBase(db_url);

async function refreshAuth() {
	if (pb.authStore.token) {
		try {
			await pb.collection('users').authRefresh();
		} catch (error) {
			console.error(error);
		}
	}
}

refreshAuth();
