I can eazy return the current admin in view after use PassportJs to authenticate by this
dashboard(req,res,next){
var CurentAdmin = req.user.adminname
res.render('admin/dashboard',{layout:'admin',CurentAdmin})
}
And just call "CurentAdmin" in this view
But i want to show the current admin have logged in in a layout template. How can i do it.
This is a part of file layout "admin.handelbars"(a layout not a view)
<div class="admin-detail">
<p class="admin-name">{{ Current Admin must be here }}</p>
<i class="admin-icon fas fa-chevron-down"></i>
<div class="admin-actions">
<div class="admin-logout">Đăng xuất</div>
</div>
</div>