index.js
function logout(options) {
  return async function logoutHandler(ctx) {
    let referer = formatReferer(ctx, options.logoutPath, options.rootPath);
    const user = ctx.session[options.userField];
    if (!user) {
      return redirect(ctx, referer);
    }

    const redirectURL = await options.logoutCallback(ctx, user);

    ctx.session[options.userField] = null;
    if (redirectURL) {
      referer = redirectURL;
    }
    redirect(ctx, referer);
  };
}
function logout(options) {
  return async function logoutHandler(ctx) {
    let referer = formatReferer(ctx, options.logoutPath, options.rootPath);
    const user = ctx.session[options.userField];
    if (!user) {
      return redirect(ctx, referer);
    }

    const redirectURL = await options.logoutCallback(ctx, user);

    ctx.session[options.userField] = null;
    if (redirectURL) {
      referer = redirectURL;
    }
    redirect(ctx, referer);
  };
}
function logout ( options ) { return async function logoutHandler ( ctx ) { let referer = formatReferer ( ctx , options . logoutPath , options . rootPath ) ; const user = ctx . session [ options . userField ] ; if ( ! user ) { return redirect ( ctx , referer ) ; } const redirectURL = await options . logoutCallback ( ctx , user ) ; ctx . session [ options . userField ] = null ; if ( redirectURL ) { referer = redirectURL ; } redirect ( ctx , referer ) ; } ; }
return a logoutHandler
@param {Object} options
@return {Function}
return a logoutHandler