aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-10-20 18:05:43 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2019-10-20 18:05:43 +0200
commit115d8dc7029fff39994052fe51693509f035b489 (patch)
tree5c03480f4930340996da6ff2a86dcc6972137df0 /app
parentImplement user settings (diff)
downloadferdium-server-115d8dc7029fff39994052fe51693509f035b489.tar.gz
ferdium-server-115d8dc7029fff39994052fe51693509f035b489.tar.zst
ferdium-server-115d8dc7029fff39994052fe51693509f035b489.zip
Fix user settings
Diffstat (limited to 'app')
-rw-r--r--app/Controllers/Http/UserController.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/app/Controllers/Http/UserController.js b/app/Controllers/Http/UserController.js
index 3f6103a..2a35f93 100644
--- a/app/Controllers/Http/UserController.js
+++ b/app/Controllers/Http/UserController.js
@@ -133,6 +133,8 @@ class UserController {
133 response.send('Missing or invalid api token'); 133 response.send('Missing or invalid api token');
134 } 134 }
135 135
136 const settings = typeof auth.user.settings === 'string' ? JSON.parse(auth.user.settings) : auth.user.settings;
137
136 return response.send({ 138 return response.send({
137 accountType: 'individual', 139 accountType: 'individual',
138 beta: false, 140 beta: false,
@@ -146,7 +148,7 @@ class UserController {
146 isSubscriptionOwner: true, 148 isSubscriptionOwner: true,
147 lastname: 'Franz', 149 lastname: 'Franz',
148 locale: 'en-US', 150 locale: 'en-US',
149 ...auth.user.settings || {}, 151 ...settings || {},
150 }); 152 });
151 } 153 }
152 154
@@ -169,7 +171,19 @@ class UserController {
169 await auth.user.save(); 171 await auth.user.save();
170 172
171 return response.send({ 173 return response.send({
172 status: 'success' 174 accountType: 'individual',
175 beta: false,
176 donor: {},
177 email: auth.user.email,
178 emailValidated: true,
179 features: {},
180 firstname: 'Franz',
181 id: '82c1cf9d-ab58-4da2-b55e-aaa41d2142d8',
182 isPremium: true,
183 isSubscriptionOwner: true,
184 lastname: 'Franz',
185 locale: 'en-US',
186 ...newSettings || {},
173 }); 187 });
174 } 188 }
175 189