fixed storing settings in a wrong format
This commit is contained in:
parent
7a1e659c42
commit
c9a24b0d1a
@ -40,8 +40,10 @@ module.exports = {
|
|||||||
res.locals.avatar = result[0].User_Avatar || ""
|
res.locals.avatar = result[0].User_Avatar || ""
|
||||||
res.locals.publicKey = result[0].User_PublicKey || ""
|
res.locals.publicKey = result[0].User_PublicKey || ""
|
||||||
res.locals.privateKey = result[0].User_PrivateKey || ""
|
res.locals.privateKey = result[0].User_PrivateKey || ""
|
||||||
res.locals.settings = result[0].User_Settings || {}
|
res.locals.settings = JSON.parse(result[0].User_Settings)
|
||||||
|
if(res.locals.settings == "null")res.locals.settings = {}
|
||||||
if(res.locals.settings == null)res.locals.settings = {}
|
if(res.locals.settings == null)res.locals.settings = {}
|
||||||
|
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
res.status(400)
|
res.status(400)
|
||||||
|
@ -42,7 +42,7 @@ module.exports = {
|
|||||||
console.log(5,"changing settings", setting_to_change, setting_new_value, res.locals.settings)
|
console.log(5,"changing settings", setting_to_change, setting_new_value, res.locals.settings)
|
||||||
|
|
||||||
let sql = "update ipost.users set User_Settings=? where User_Name=?"
|
let sql = "update ipost.users set User_Settings=? where User_Name=?"
|
||||||
let values = [res.locals.settings,res.locals.username]
|
let values = [JSON.stringify(res.locals.settings),res.locals.username]
|
||||||
con.query(sql, values, function (err, result) {
|
con.query(sql, values, function (err, result) {
|
||||||
if(err) {
|
if(err) {
|
||||||
res.json({"status":"error","code":err})
|
res.json({"status":"error","code":err})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user