Skip to content
Snippets Groups Projects
Commit 1381033f authored by Daniel's avatar Daniel
Browse files

app: bugfix: Use number id

parent 43399d4a
Branches
No related merge requests found
......@@ -15,15 +15,21 @@ let app = express.Router()
// Administration.
app.post('/init', async function (req, res, next) {
let id = req.projek.driver.id
let id = Number(req.projek.driver.id)
let token = req.body.token
try {
cloud.register(id, token)
let model = await db.ChatHistory.prepareAsync([id, relay.get(id)])
res.json({
chats: model.chats
chats: model.chats.map(chat => {
return {
from: chat.owner_id === id ? 'me' : 'them',
text: chat.content
}
})
})
} catch (e) {
next(e)
......@@ -31,7 +37,7 @@ app.post('/init', async function (req, res, next) {
})
app.delete('/', function (req, res) {
let id = req.projek.driver.id
let id = Number(req.projek.driver.id)
cloud.unregister(id)
relay.disassociate(id)
......@@ -42,7 +48,7 @@ app.delete('/', function (req, res) {
// Messaging.
app.post('/', async function (req, res, next) {
let id = req.projek.driver.id
let id = Number(req.projek.driver.id)
let message = req.body.message
try {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment