general-tabs.js
884 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);
};
const getCommonHeaderNew = (req, res, next) => {
let channel = req.query.channel;
let uid = req.user.uid;
let clientService = _.get(req.app.locals.pc, 'clientService.new', false);
let result = req.ctx(headerModel).getHomeNavNew(uid, channel, req.originalUrl, clientService);
_.merge(res.locals, result);
next();
};
module.exports = {
getCommonHeader,
getCommonHeaderNew
};