blob: 4d67dede990031c84dcaec4d297a3e44aea1326e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import { DbData, db } from './db.ts';
const addTokenStatement = db.prepare(`INSERT INTO tokens(data) VALUES (?);`);
const getTokenStatement = db.prepare(`SELECT data FROM tokens;`);
export function addToken(token: string): void {
addTokenStatement.run(token);
}
export function getToken(): string|null {
const data = getTokenStatement.get() as DbData|undefined;
if (data === undefined) return null;
return data.data;
}
|