mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-31 20:22:27 +08:00
chore(server/session): implement session get
This commit is contained in:
parent
dfb8c9f4ce
commit
b313b0b965
@ -6,7 +6,12 @@ import config from "../services/config.js";
|
|||||||
class SQLiteSessionStore extends Store {
|
class SQLiteSessionStore extends Store {
|
||||||
|
|
||||||
get(sid: string, callback: (err: any, session?: session.SessionData | null) => void): void {
|
get(sid: string, callback: (err: any, session?: session.SessionData | null) => void): void {
|
||||||
return callback(null);
|
const data = sql.getValue<string>(/*sql*/`SELECT data FROM sessions WHERE id = ?`, sid);
|
||||||
|
let session = null;
|
||||||
|
if (data) {
|
||||||
|
session = JSON.parse(data);
|
||||||
|
}
|
||||||
|
return callback(null, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
set(id: string, session: session.SessionData, callback?: (err?: any) => void): void {
|
set(id: string, session: session.SessionData, callback?: (err?: any) => void): void {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user