From 5d43aa32126d50b524af9cd20a870f4f2e8ebc63 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Sat, 10 Jan 2015 14:50:28 -0500 Subject: [PATCH] ability to redirect the user from anywhere just send ``` callback({ status: 302, path: '/user/psychobunny' }); ``` --- src/routes/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/routes/index.js b/src/routes/index.js index ffee5b8272..eb35860928 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -211,6 +211,10 @@ function handleErrors(app, middleware) { return res.sendStatus(403); } + if (parseInt(err.status, 10) === 302 && err.path) { + return res.locals.isAPI ? res.status(302).json(err) : res.redirect(err.path); + } + res.status(err.status || 500); if (res.locals.isAPI) {