Add /api/settings to get current settings as JSON

This commit is contained in:
Cadence Ember 2022-07-27 18:54:45 +12:00
parent f04be0d3f9
commit 5e6b2bf31c
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
1 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,17 @@ const validate = require("../utils/validate")
const V = validate.V const V = validate.V
module.exports = [ module.exports = [
{
route: "/api/settings", methods: ["GET"], code: async ({req}) => {
const user = getUser(req)
const settings = user.getSettingsOrDefaults()
return {
statusCode: 200,
contentType: "application/json",
content: settings
}
}
},
{ {
route: "/settings", methods: ["GET"], code: async ({req}) => { route: "/settings", methods: ["GET"], code: async ({req}) => {
const user = getUser(req) const user = getUser(req)