show logged in user

This commit is contained in:
Andreas Brett
2021-10-22 13:05:52 +02:00
parent c6fc385289
commit 9ad8e5f56a
4 changed files with 31 additions and 0 deletions

View File

@@ -865,6 +865,27 @@ exports.entryPage = "dashboard";
}
});
socket.on("getUsername", async (callback) => {
try {
checkLogin(socket);
let user = await R.findOne("user", " id = ? AND active = 1 ", [
socket.userID,
]);
callback({
ok: true,
data: user.username,
});
} catch (e) {
callback({
ok: false,
msg: e.message,
});
}
});
socket.on("getSettings", async (callback) => {
try {
checkLogin(socket);