From 9a71163dda2e0857e2fe3d32be18a54e35bc837c Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 2 Sep 2023 01:06:11 +0200 Subject: [javascript] began reworking token handling to match what is done with the haskell client --- nodejs/database/config.js | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 nodejs/database/config.js (limited to 'nodejs/database/config.js') diff --git a/nodejs/database/config.js b/nodejs/database/config.js deleted file mode 100644 index 7a50f68..0000000 --- a/nodejs/database/config.js +++ /dev/null @@ -1,23 +0,0 @@ -import db from './db.js'; - -const getTokenStatement = db.prepare(`SELECT value->>'token' as token from config where key = 'register_data';`); -const registerAgentStatement = db.prepare(`INSERT INTO config(key, value) VALUES ('register_data', json(?));`); - -export function getToken() { - try { - return getTokenStatement.get().token; - } catch (err) { - console.log(err); - return null; - } -} - -export function registerAgent(data) { - try { - registerAgentStatement.run(JSON.stringify(data)); - return true; - } catch (err) { - console.log(err); - return false; - } -} -- cgit v1.2.3