index.js
async function () {
        let redirectURL = ctx.url;
        try {
          redirectURL = encodeURIComponent(redirectURL);
        } catch (e) {
          // URIError: URI malformed
          // use source url
        }
        const loginURL = options.loginPath + '?redirect=' + redirectURL;
        debug('redirect to %s', loginURL);
        redirect(ctx, loginURL);
      }
async function () {
        let redirectURL = ctx.url;
        try {
          redirectURL = encodeURIComponent(redirectURL);
        } catch (e) {
          // URIError: URI malformed
          // use source url
        }
        const loginURL = options.loginPath + '?redirect=' + redirectURL;
        debug('redirect to %s', loginURL);
        redirect(ctx, loginURL);
      }
async function ( ) { let redirectURL = ctx . url ; try { redirectURL = encodeURIComponent ( redirectURL ) ; } catch ( e ) { // URIError: URI malformed // use source url } const loginURL = options . loginPath + '?redirect=' + redirectURL ; debug ( 'redirect to %s' , loginURL ) ; redirect ( ctx , loginURL ) ; }
make next handle an Async Function so it can use await next in redirectHandle
make next handle an Async Function so it can use await next in redirectHandle