-
Notifications
You must be signed in to change notification settings - Fork 0
/
HomeControllers.js
43 lines (36 loc) · 1.01 KB
/
HomeControllers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const HomeTemplate = require("../json/home.json");
const RegisterTemplate = require("../json/register.json");
const AccountManager = require("../database/AccountManager.js");
const home = (req, res) => {
req.session.email = "[email protected]";
req.session.username = "RyxnDmello";
res.render("home", {
username: req.session.username ?? null,
navbar: HomeTemplate.navbar,
header: HomeTemplate.header,
features: HomeTemplate.features,
games: HomeTemplate.games,
details: HomeTemplate.details,
exclusive: HomeTemplate.exclusive,
brands: HomeTemplate.brands,
footer: HomeTemplate.footer,
});
};
const register = (req, res) => {
res.render("register", { register: RegisterTemplate });
};
const create = (req, res) => {
if (req.body.type === "CREATE") {
AccountManager.CreateAccount(req.body, req, res);
return;
}
if (req.body.type === "LOGIN") {
AccountManager.LoginAccount(req.body, req, res);
return;
}
};
module.exports = {
home,
register,
create,
};