blob: 6db856eb6f69415ed88c6dc82c1f223e3dc10ba8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import db from './db.js';
const getTokenStatement = db.prepare(`SELECT value from config where key = 'token';`);
const registerAgentStatement = db.prepare(`INSERT INTO config(key, value) VALUES ('symbol', ?), ('faction', ?), ('token', ?);`);
export function getToken() {
try {
return getTokenStatement.get().value;
} catch (err) {
console.log(err);
return null;
}
}
export function registerAgent(symbol, faction, token) {
try {
registerAgentStatement.run(symbol, faction, token);
return true;
} catch (err) {
console.log(err);
return false;
}
}
|