-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.js
74 lines (69 loc) · 2.74 KB
/
theme.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//------------------------------------------------------------------------------
//---------------------------INITIALIZE DB CONNECTION---------------------------
//------------------------------------------------------------------------------
const Pool = require('pg').Pool
const pool = new Pool({
user: 'haeylaqqqkjveg',
host: 'ec2-100-25-75-194.compute-1.amazonaws.com',
database: 'd4mt626ufi3h00',
password: '1c52845abaa1df2175c6da25b8f959485d69e792d02984ff4ee6a7a291d74a0e',
port: 5432,
ssl: true,
})
//------------------------------------------------------------------------------
//---------------------------------DEFAULT DARK---------------------------------
//------------------------------------------------------------------------------
const defaultDark = (request, response) => {
const sql = "UPDATE users SET style = 'style' where id = " + request.user.id + ";";
pool.query(sql, (error, results) => {
if (error) {
throw error;
}
response.redirect('./adminPage')
});
}
//------------------------------------------------------------------------------
//---------------------------------LIGHT THEME----------------------------------
//------------------------------------------------------------------------------
const lightTheme = (request, response) => {
const sql = "UPDATE users SET style = 'lightTheme' where id = " + request.user.id + ";";
pool.query(sql, (error, results) => {
if (error) {
throw error;
}
response.redirect('./adminPage')
});
}
//------------------------------------------------------------------------------
//-------------------------------DASHBOARD THEME--------------------------------
//------------------------------------------------------------------------------
const dashboardTheme = (request, response) => {
const sql = "UPDATE users SET style = 'dashboard' where id = " + request.user.id + ";";
pool.query(sql, (error, results) => {
if (error) {
throw error;
}
response.redirect('./adminPage')
});
}
//------------------------------------------------------------------------------
//---------------------------------METAL THEME----------------------------------
//------------------------------------------------------------------------------
const metalTheme = (request, response) => {
const sql = "UPDATE users SET style = 'metal' where id = " + request.user.id + ";";
pool.query(sql, (error, results) => {
if (error) {
throw error;
}
response.redirect('./adminPage')
});
}
//------------------------------------------------------------------------------
//--------------------------------EXPORT MODULES--------------------------------
//------------------------------------------------------------------------------
module.exports = {
defaultDark,
lightTheme,
dashboardTheme,
metalTheme
}