Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
how to redirect my login page when throw 400? I catch the error. an infinite redirect loop.
server.use(async (ctx, next) => {
await next().catch(err => {
const {status} = err
if (status == 400) {
ctx.redirect('/login')
}
console.log(err)
ctx.app.emit('error', err, ctx);
});
})
router.get('*', verifyRequest(), async ctx => {
console.log('other---')
await handle(ctx.req, ctx.res);
ctx.respond = false;
ctx.res.statusCode = 200;
const { shop, accessToken } = ctx.session;
});