aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/oauth-clients.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/oauth-clients.ts')
-rw-r--r--server/controllers/api/oauth-clients.ts21
1 files changed, 11 insertions, 10 deletions
diff --git a/server/controllers/api/oauth-clients.ts b/server/controllers/api/oauth-clients.ts
index b9bc0534f..f7dac598c 100644
--- a/server/controllers/api/oauth-clients.ts
+++ b/server/controllers/api/oauth-clients.ts
@@ -24,16 +24,17 @@ function getLocalClient (req: express.Request, res: express.Response, next: expr
24 return res.type('json').status(403).end() 24 return res.type('json').status(403).end()
25 } 25 }
26 26
27 db.OAuthClient.loadFirstClient(function (err, client) { 27 db.OAuthClient.loadFirstClient()
28 if (err) return next(err) 28 .then(client => {
29 if (!client) return next(new Error('No client available.')) 29 if (!client) throw new Error('No client available.')
30 30
31 const json: OAuthClientLocal = { 31 const json: OAuthClientLocal = {
32 client_id: client.clientId, 32 client_id: client.clientId,
33 client_secret: client.clientSecret 33 client_secret: client.clientSecret
34 } 34 }
35 res.json(json) 35 res.json(json)
36 }) 36 })
37 .catch(err => next(err))
37} 38}
38 39
39// --------------------------------------------------------------------------- 40// ---------------------------------------------------------------------------