From fadf619ad61a016c1c7fc53de5a8f398a4f77519 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 Dec 2017 11:18:49 +0100 Subject: Save --- server/controllers/api/videos/channel.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'server/controllers/api/videos') diff --git a/server/controllers/api/videos/channel.ts b/server/controllers/api/videos/channel.ts index 683b0448d..315469115 100644 --- a/server/controllers/api/videos/channel.ts +++ b/server/controllers/api/videos/channel.ts @@ -92,16 +92,15 @@ async function addVideoChannelRetryWrapper (req: express.Request, res: express.R return res.type('json').status(204).end() } -async function addVideoChannel (req: express.Request, res: express.Response) { +function addVideoChannel (req: express.Request, res: express.Response) { const videoChannelInfo: VideoChannelCreate = req.body const account: AccountModel = res.locals.oauth.token.User.Account - let videoChannelCreated: VideoChannelModel - await sequelizeTypescript.transaction(async t => { - videoChannelCreated = await createVideoChannel(videoChannelInfo, account, t) - }) + return sequelizeTypescript.transaction(async t => { + const videoChannelCreated = await createVideoChannel(videoChannelInfo, account, t) - logger.info('Video channel with uuid %s created.', videoChannelCreated.uuid) + logger.info('Video channel with uuid %s created.', videoChannelCreated.uuid) + }) } async function updateVideoChannelRetryWrapper (req: express.Request, res: express.Response, next: express.NextFunction) { -- cgit v1.2.3