Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Bug for dashboard : Handled Layout rendering for corresponding … #108

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ app.use(express.static("public"));

// Templating Engine
app.use(expressLayout);
app.set('layout', './layouts/main');
app.set('view engine', 'ejs');

// Helper for active route
Expand Down
113 changes: 43 additions & 70 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions server/routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ const authMiddleware = (req, res, next) => {
* GET /
* Admin - Login Page
*/

router.use((req, res, next) => {
res.locals.layout = './layouts/admin'; // Set the layout for the response
next(); // Call the next middleware or route handler
});

router.get('/admin', restrictAuthRouteMiddleware, async (req, res) => {
try {
const locals = {
Expand Down
6 changes: 6 additions & 0 deletions server/routes/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ const transporter = require('../config/nodemailerConfig');
* GET /
* HOME
*/

router.use((req, res, next) => {
res.locals.layout = './layouts/main'; // Set the layout for the response
next(); // Call the next middleware or route handler
});

router.get('/', async (req, res) => {
try {
const locals = {
Expand Down
2 changes: 1 addition & 1 deletion views/partials/header_admin.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<header class="header">
<a href="/" class="header__logo">Admin Panel</a>
<a href="/dashboard" class="header__logo">Admin Panel</a>

<nav class="header__nav">
<ul>
Expand Down
Loading