mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Move to promises
Closes https://github.com/Chocobozzz/PeerTube/issues/74
This commit is contained in:
parent
5fe7e89831
commit
6fcd19ba73
88 changed files with 1980 additions and 2505 deletions
|
@ -24,16 +24,17 @@ function getLocalClient (req: express.Request, res: express.Response, next: expr
|
|||
return res.type('json').status(403).end()
|
||||
}
|
||||
|
||||
db.OAuthClient.loadFirstClient(function (err, client) {
|
||||
if (err) return next(err)
|
||||
if (!client) return next(new Error('No client available.'))
|
||||
db.OAuthClient.loadFirstClient()
|
||||
.then(client => {
|
||||
if (!client) throw new Error('No client available.')
|
||||
|
||||
const json: OAuthClientLocal = {
|
||||
client_id: client.clientId,
|
||||
client_secret: client.clientSecret
|
||||
}
|
||||
res.json(json)
|
||||
})
|
||||
const json: OAuthClientLocal = {
|
||||
client_id: client.clientId,
|
||||
client_secret: client.clientSecret
|
||||
}
|
||||
res.json(json)
|
||||
})
|
||||
.catch(err => next(err))
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue