general-tabs.js 518 Bytes
'use strict';

const _ = require('lodash');
const headerModel = require('../models/general-tabs-service');

const getCommonHeader = (req, res, next) => {
    let channel = req.query.channel;
    let uid = req.user.uid;
    let clientService = _.get(req.app.locals.pc, 'clientService.new', false);

    req.ctx(headerModel).getHomeNav(uid, channel, req.originalUrl, clientService).then((result)=>{
        _.merge(res.locals, result);
        next();
    }).catch(next);
};

module.exports = {
    getCommonHeader
};