~cadence/cloudtube

5e6b2bf31cbd6360ea4d1b1790fca9c7b6bed60c — Cadence Ember 1 year, 11 months ago f04be0d
Add /api/settings to get current settings as JSON
1 files changed, 11 insertions(+), 0 deletions(-)

M api/settings.js
M api/settings.js => api/settings.js +11 -0
@@ 8,6 8,17 @@ const V = validate.V

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}) => {
			const user = getUser(req)
			const settings = user.getSettings()