new api refactor setup

This commit is contained in:
bootunloader
2025-12-31 07:56:38 +02:00
parent 15f62eaebf
commit c91fed55bb
8 changed files with 345 additions and 35 deletions

View File

@@ -42,11 +42,10 @@ async function authenticateDB() {
async function ensureAuthenticated() {
try {
console.log("⏳ Ensuring authentication with SurrealDB...");
await db.query("RETURN 1");
} catch (error: any) {
if (error.status === 401) {
console.warn("⚠️ Token expired. Attempting reconnection...");
console.warn("⚠️ SurrealDB Auth token expired. Attempting reconnection...");
try {
// Full reconnection instead of just re-authentication
await db.close();