mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2026-03-10 21:25:04 +00:00
Compare commits
43 Commits
remotes/or
...
shobhit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
637c4205af | ||
|
|
a7d34eca09 | ||
|
|
d476cbc893 | ||
|
|
80e01714d8 | ||
| adf3da4bb8 | |||
| 76ef3a6561 | |||
| b337277aa4 | |||
| f4b44c9654 | |||
| 27efa858d5 | |||
| 00ed9d64c5 | |||
| d1233e77ed | |||
| bb6c7a07fc | |||
| 9eb4f603df | |||
| 8179b51844 | |||
|
|
f1e5c584e1 | ||
|
|
c2ef222cf6 | ||
|
|
3cbcb5054c | ||
| 6deb15d9d4 | |||
| 4a5c404be3 | |||
| 7841fa1798 | |||
|
|
bac2cd7719 | ||
| f14e8bd970 | |||
|
|
14e09d88ea | ||
| c241455c4b | |||
| 4c1459d890 | |||
|
|
c14263988e | ||
|
|
64657fa3af | ||
|
|
d072a5ff95 | ||
|
|
9c0dac507f | ||
|
|
5168de65c1 | ||
|
|
2536547c63 | ||
|
|
42a07ffa5e | ||
|
|
7558602a90 | ||
| 8de496826a | |||
|
|
3b682bae18 | ||
|
|
5acc7a64e0 | ||
|
|
71b6965830 | ||
|
|
893cad7e7e | ||
| 5df28e0e77 | |||
|
|
39098e917f | ||
|
|
29c07a9b14 | ||
|
|
15f106ed1a | ||
| dcd03d7888 |
@@ -50,7 +50,7 @@ exports.signup = (req, res) => {
|
|||||||
return res.status(400).json(errors);
|
return res.status(400).json(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
let idToken, userId;
|
let token, userId;
|
||||||
|
|
||||||
db.doc(`/users/${newUser.handle}`)
|
db.doc(`/users/${newUser.handle}`)
|
||||||
.get()
|
.get()
|
||||||
@@ -68,8 +68,8 @@ exports.signup = (req, res) => {
|
|||||||
userId = data.user.uid;
|
userId = data.user.uid;
|
||||||
return data.user.getIdToken();
|
return data.user.getIdToken();
|
||||||
})
|
})
|
||||||
.then((token) => {
|
.then((idToken) => {
|
||||||
idToken = token;
|
token = idToken;
|
||||||
const userCred = {
|
const userCred = {
|
||||||
email: req.body.email,
|
email: req.body.email,
|
||||||
handle: newUser.handle,
|
handle: newUser.handle,
|
||||||
@@ -79,7 +79,7 @@ exports.signup = (req, res) => {
|
|||||||
return db.doc(`/users/${newUser.handle}`).set(userCred);
|
return db.doc(`/users/${newUser.handle}`).set(userCred);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return res.status(201).json({ idToken });
|
return res.status(201).json({ token });
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
@@ -121,11 +121,11 @@ exports.login = (req, res) => {
|
|||||||
return data.user.getIdToken();
|
return data.user.getIdToken();
|
||||||
})
|
})
|
||||||
.then((token) => {
|
.then((token) => {
|
||||||
return res.json({ token });
|
return res.status(200).json({ token });
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
if (err.code === "auth/wrong-password") {
|
if (err.code === "auth/wrong-password" || err.code === "auth/invalid-email") {
|
||||||
return res
|
return res
|
||||||
.status(403)
|
.status(403)
|
||||||
.json({ general: "Invalid credentials. Please try again." });
|
.json({ general: "Invalid credentials. Please try again." });
|
||||||
@@ -214,3 +214,20 @@ exports.getUserDetails = (req, res) => {
|
|||||||
return res.status(500).json({ error: err.code });
|
return res.status(500).json({ error: err.code });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.getAuthenticatedUser = (req, res) => {
|
||||||
|
let userData = {};
|
||||||
|
db.doc(`/users/${req.user.handle}`)
|
||||||
|
.get()
|
||||||
|
.then((doc) => {
|
||||||
|
if (doc.exists) {
|
||||||
|
userData.credentials = doc.data();
|
||||||
|
return res.status(200).json({userData});
|
||||||
|
} else {
|
||||||
|
return res.status(400).json({error: "User not found."})
|
||||||
|
}})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
return res.status(500).json({ error: err.code });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ app.use(cors());
|
|||||||
* handlers/users.js *
|
* handlers/users.js *
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
const {
|
const {
|
||||||
|
getAuthenticatedUser,
|
||||||
getUserDetails,
|
getUserDetails,
|
||||||
getProfileInfo,
|
getProfileInfo,
|
||||||
login,
|
login,
|
||||||
@@ -34,6 +35,8 @@ app.get("/getProfileInfo", fbAuth, getProfileInfo);
|
|||||||
// Updates the currently logged in user's profile information
|
// Updates the currently logged in user's profile information
|
||||||
app.post("/updateProfileInfo", fbAuth, updateProfileInfo);
|
app.post("/updateProfileInfo", fbAuth, updateProfileInfo);
|
||||||
|
|
||||||
|
app.get("/user", fbAuth, getAuthenticatedUser);
|
||||||
|
|
||||||
/*------------------------------------------------------------------*
|
/*------------------------------------------------------------------*
|
||||||
* handlers/post.js *
|
* handlers/post.js *
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
|||||||
79
functions/package-lock.json
generated
79
functions/package-lock.json
generated
@@ -70,15 +70,9 @@
|
|||||||
"integrity": "sha512-foQHhvyB0RR+mb/+wmHXd/VOU+D8fruFEW1k79Q9wzyTPpovMBa1Mcns5fwEWBhUfi8bmoEtaGB8RSAHnTFzTg=="
|
"integrity": "sha512-foQHhvyB0RR+mb/+wmHXd/VOU+D8fruFEW1k79Q9wzyTPpovMBa1Mcns5fwEWBhUfi8bmoEtaGB8RSAHnTFzTg=="
|
||||||
},
|
},
|
||||||
"@firebase/database": {
|
"@firebase/database": {
|
||||||
<<<<<<< HEAD
|
|
||||||
"version": "0.5.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.5.3.tgz",
|
|
||||||
"integrity": "sha512-LnXKRE1AmjlS+iRF7j8vx+Ni8x85CmLP5u5Pw5rDKhKLn2eTR1tJKD937mUeeGEtDHwR1rrrkLYOqRR2cSG3hQ==",
|
|
||||||
=======
|
|
||||||
"version": "0.5.4",
|
"version": "0.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.5.4.tgz",
|
||||||
"integrity": "sha512-Hz1Bi3fzIcNNocE4EhvvwoEQGurG2BGssWD3/6a2bzty+K1e57SLea2Ied8QYNBUU1zt/4McHfa3Y71EQIyn/w==",
|
"integrity": "sha512-Hz1Bi3fzIcNNocE4EhvvwoEQGurG2BGssWD3/6a2bzty+K1e57SLea2Ied8QYNBUU1zt/4McHfa3Y71EQIyn/w==",
|
||||||
>>>>>>> 7969d3b10bc35a9078834c5ee2ba8c8fd60d338f
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/database-types": "0.4.3",
|
"@firebase/database-types": "0.4.3",
|
||||||
"@firebase/logger": "0.1.25",
|
"@firebase/logger": "0.1.25",
|
||||||
@@ -113,11 +107,7 @@
|
|||||||
"@firebase/firestore": {
|
"@firebase/firestore": {
|
||||||
"version": "1.5.3",
|
"version": "1.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.5.3.tgz",
|
||||||
<<<<<<< HEAD
|
|
||||||
"integrity": "sha512-CPYLvkGZBKE47oQC9a0q13UMVRj3LvnSbB1nOerktE3CGRHKy44LxDumamN8Kj067hV/80mKK9FdbeUufwO/Rg==",
|
|
||||||
=======
|
|
||||||
"integrity": "sha512-O/yAbXpitOA6g627cUl0/FHYlkTy1EiEKMKOlnlMOJF2fH+nLVZREXjsrCC7N2tIvTn7yYwfpZ4zpSNvrhwiTA==",
|
"integrity": "sha512-O/yAbXpitOA6g627cUl0/FHYlkTy1EiEKMKOlnlMOJF2fH+nLVZREXjsrCC7N2tIvTn7yYwfpZ4zpSNvrhwiTA==",
|
||||||
>>>>>>> 7969d3b10bc35a9078834c5ee2ba8c8fd60d338f
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/firestore-types": "1.5.0",
|
"@firebase/firestore-types": "1.5.0",
|
||||||
"@firebase/logger": "0.1.25",
|
"@firebase/logger": "0.1.25",
|
||||||
@@ -607,12 +597,6 @@
|
|||||||
"integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
|
"integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ansi-regex": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
|
|
||||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"ansi-styles": {
|
"ansi-styles": {
|
||||||
"version": "3.2.1",
|
"version": "3.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||||
@@ -851,7 +835,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"code-point-at": {
|
"code-point-at": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
|
||||||
@@ -1190,15 +1174,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"end-of-stream": {
|
"end-of-stream": {
|
||||||
<<<<<<< HEAD
|
|
||||||
"version": "1.4.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
|
|
||||||
"integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==",
|
|
||||||
=======
|
|
||||||
"version": "1.4.3",
|
"version": "1.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.3.tgz",
|
||||||
"integrity": "sha512-cbNhPFS6MlYlWTGncSiDYbdqKhwWFy7kNeb1YSOG6K65i/wPTkLVCJQj0hXA4j0m5Da+hBWnqopEnu1FFelisQ==",
|
"integrity": "sha512-cbNhPFS6MlYlWTGncSiDYbdqKhwWFy7kNeb1YSOG6K65i/wPTkLVCJQj0hXA4j0m5Da+hBWnqopEnu1FFelisQ==",
|
||||||
>>>>>>> 7969d3b10bc35a9078834c5ee2ba8c8fd60d338f
|
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
@@ -1274,7 +1252,6 @@
|
|||||||
"progress": "^2.0.0",
|
"progress": "^2.0.0",
|
||||||
"regexpp": "^2.0.1",
|
"regexpp": "^2.0.1",
|
||||||
"semver": "^5.5.1",
|
"semver": "^5.5.1",
|
||||||
"strip-ansi": "^4.0.0",
|
|
||||||
"strip-json-comments": "^2.0.1",
|
"strip-json-comments": "^2.0.1",
|
||||||
"table": "^5.2.3",
|
"table": "^5.2.3",
|
||||||
"text-table": "^0.2.0"
|
"text-table": "^0.2.0"
|
||||||
@@ -1710,8 +1687,7 @@
|
|||||||
"functional-red-black-tree": {
|
"functional-red-black-tree": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
|
||||||
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"gaxios": {
|
"gaxios": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
@@ -2259,15 +2235,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gtoken": {
|
"gtoken": {
|
||||||
<<<<<<< HEAD
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-XaRCfHJxhj06LmnWNBzVTAr85NfAErq0W1oabkdqwbq3uL/QTB1kyvGog361Uu2FMG/8e3115sIy/97Rnd4GjQ==",
|
|
||||||
=======
|
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-4.1.0.tgz",
|
||||||
"integrity": "sha512-wqyn2gf5buzEZN4QNmmiiW2i2JkEdZnL7Z/9p44RtZqgt4077m4khRgAYNuu8cBwHWCc6MsP6eDUn/KkF6jFIw==",
|
"integrity": "sha512-wqyn2gf5buzEZN4QNmmiiW2i2JkEdZnL7Z/9p44RtZqgt4077m4khRgAYNuu8cBwHWCc6MsP6eDUn/KkF6jFIw==",
|
||||||
>>>>>>> 7969d3b10bc35a9078834c5ee2ba8c8fd60d338f
|
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"gaxios": "^2.0.0",
|
"gaxios": "^2.0.0",
|
||||||
@@ -2441,8 +2411,7 @@
|
|||||||
"imurmurhash": {
|
"imurmurhash": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||||
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
|
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"inflight": {
|
"inflight": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
@@ -2457,8 +2426,7 @@
|
|||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"inquirer": {
|
"inquirer": {
|
||||||
"version": "6.5.2",
|
"version": "6.5.2",
|
||||||
@@ -2476,7 +2444,6 @@
|
|||||||
"mute-stream": "0.0.7",
|
"mute-stream": "0.0.7",
|
||||||
"run-async": "^2.2.0",
|
"run-async": "^2.2.0",
|
||||||
"rxjs": "^6.4.0",
|
"rxjs": "^6.4.0",
|
||||||
"string-width": "^2.1.0",
|
|
||||||
"strip-ansi": "^5.1.0",
|
"strip-ansi": "^5.1.0",
|
||||||
"through": "^2.3.6"
|
"through": "^2.3.6"
|
||||||
},
|
},
|
||||||
@@ -2525,14 +2492,6 @@
|
|||||||
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
|
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"is-fullwidth-code-point": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
|
||||||
"requires": {
|
|
||||||
"number-is-nan": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"is-obj": {
|
"is-obj": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
|
||||||
@@ -2929,7 +2888,6 @@
|
|||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@@ -3374,8 +3332,7 @@
|
|||||||
"signal-exit": {
|
"signal-exit": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"slice-ansi": {
|
"slice-ansi": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
@@ -3384,8 +3341,7 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-styles": "^3.2.0",
|
"ansi-styles": "^3.2.0",
|
||||||
"astral-regex": "^1.0.0",
|
"astral-regex": "^1.0.0"
|
||||||
"is-fullwidth-code-point": "^2.0.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"snakeize": {
|
"snakeize": {
|
||||||
@@ -3425,31 +3381,12 @@
|
|||||||
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz",
|
||||||
"integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo="
|
"integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo="
|
||||||
},
|
},
|
||||||
"string-width": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
|
|
||||||
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
|
||||||
"requires": {
|
|
||||||
"code-point-at": "^1.0.0",
|
|
||||||
"is-fullwidth-code-point": "^2.0.0",
|
|
||||||
"strip-ansi": "^4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"string_decoder": {
|
"string_decoder": {
|
||||||
"version": "0.10.31",
|
"version": "0.10.31",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
|
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"strip-ansi": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
|
||||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"ansi-regex": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"strip-json-comments": {
|
"strip-json-comments": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||||
@@ -3496,7 +3433,6 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"emoji-regex": "^7.0.1",
|
"emoji-regex": "^7.0.1",
|
||||||
"is-fullwidth-code-point": "^2.0.0",
|
|
||||||
"strip-ansi": "^5.1.0"
|
"strip-ansi": "^5.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3755,8 +3691,7 @@
|
|||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"write": {
|
"write": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
|
|||||||
@@ -4,6 +4,13 @@ const { admin, db } = require('./admin');
|
|||||||
// The function will only execute if the user is logged in, or rather, they have
|
// The function will only execute if the user is logged in, or rather, they have
|
||||||
// a valid token
|
// a valid token
|
||||||
module.exports = (req, res, next) => {
|
module.exports = (req, res, next) => {
|
||||||
|
console.log(req);
|
||||||
|
console.log(req.body);
|
||||||
|
console.log(req.headers);
|
||||||
|
console.log(req.headers.authorization);
|
||||||
|
console.log(JSON.stringify(req.body));
|
||||||
|
console.log(JSON.stringify(req.header));
|
||||||
|
|
||||||
let idToken;
|
let idToken;
|
||||||
|
|
||||||
// Checking that the token exists in the header of the request
|
// Checking that the token exists in the header of the request
|
||||||
|
|||||||
398
package-lock.json
generated
398
package-lock.json
generated
@@ -2,390 +2,32 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"accepts": {
|
"js-tokens": {
|
||||||
"version": "1.3.7",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
|
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
|
||||||
|
},
|
||||||
|
"loose-envify": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"mime-types": "~2.1.24",
|
"js-tokens": "^3.0.0 || ^4.0.0"
|
||||||
"negotiator": "0.6.2"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"array-flatten": {
|
"redux": {
|
||||||
"version": "1.1.1",
|
"version": "4.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/redux/-/redux-4.0.4.tgz",
|
||||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
"integrity": "sha512-vKv4WdiJxOWKxK0yRoaK3Y4pxxB0ilzVx6dszU2W8wLxlb2yikRph4iV/ymtdJ6ZxpBLFbyrxklnT5yBbQSl3Q==",
|
||||||
},
|
|
||||||
"body-parser": {
|
|
||||||
"version": "1.19.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
|
||||||
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"bytes": "3.1.0",
|
"loose-envify": "^1.4.0",
|
||||||
"content-type": "~1.0.4",
|
"symbol-observable": "^1.2.0"
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "~1.1.2",
|
|
||||||
"http-errors": "1.7.2",
|
|
||||||
"iconv-lite": "0.4.24",
|
|
||||||
"on-finished": "~2.3.0",
|
|
||||||
"qs": "6.7.0",
|
|
||||||
"raw-body": "2.4.0",
|
|
||||||
"type-is": "~1.6.17"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bytes": {
|
"symbol-observable": {
|
||||||
"version": "3.1.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
|
||||||
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
"integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ=="
|
||||||
},
|
|
||||||
"content-disposition": {
|
|
||||||
"version": "0.5.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
|
|
||||||
"integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
|
|
||||||
"requires": {
|
|
||||||
"safe-buffer": "5.1.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content-type": {
|
|
||||||
"version": "1.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
|
|
||||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
|
||||||
},
|
|
||||||
"cookie": {
|
|
||||||
"version": "0.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
|
|
||||||
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
|
|
||||||
},
|
|
||||||
"cookie-signature": {
|
|
||||||
"version": "1.0.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
|
||||||
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
|
|
||||||
},
|
|
||||||
"cors": {
|
|
||||||
"version": "2.8.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
|
||||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
|
||||||
"requires": {
|
|
||||||
"object-assign": "^4",
|
|
||||||
"vary": "^1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"debug": {
|
|
||||||
"version": "2.6.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
|
||||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
|
||||||
"requires": {
|
|
||||||
"ms": "2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"depd": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
|
||||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
|
|
||||||
},
|
|
||||||
"destroy": {
|
|
||||||
"version": "1.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
|
||||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
|
||||||
},
|
|
||||||
"ee-first": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
|
||||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
|
||||||
},
|
|
||||||
"encodeurl": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
|
|
||||||
},
|
|
||||||
"escape-html": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
|
||||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
|
||||||
},
|
|
||||||
"eslint-plugin-promise": {
|
|
||||||
"version": "4.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz",
|
|
||||||
"integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw=="
|
|
||||||
},
|
|
||||||
"etag": {
|
|
||||||
"version": "1.8.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
|
||||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
|
||||||
},
|
|
||||||
"express": {
|
|
||||||
"version": "4.17.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
|
|
||||||
"integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
|
|
||||||
"requires": {
|
|
||||||
"accepts": "~1.3.7",
|
|
||||||
"array-flatten": "1.1.1",
|
|
||||||
"body-parser": "1.19.0",
|
|
||||||
"content-disposition": "0.5.3",
|
|
||||||
"content-type": "~1.0.4",
|
|
||||||
"cookie": "0.4.0",
|
|
||||||
"cookie-signature": "1.0.6",
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "~1.1.2",
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"etag": "~1.8.1",
|
|
||||||
"finalhandler": "~1.1.2",
|
|
||||||
"fresh": "0.5.2",
|
|
||||||
"merge-descriptors": "1.0.1",
|
|
||||||
"methods": "~1.1.2",
|
|
||||||
"on-finished": "~2.3.0",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"path-to-regexp": "0.1.7",
|
|
||||||
"proxy-addr": "~2.0.5",
|
|
||||||
"qs": "6.7.0",
|
|
||||||
"range-parser": "~1.2.1",
|
|
||||||
"safe-buffer": "5.1.2",
|
|
||||||
"send": "0.17.1",
|
|
||||||
"serve-static": "1.14.1",
|
|
||||||
"setprototypeof": "1.1.1",
|
|
||||||
"statuses": "~1.5.0",
|
|
||||||
"type-is": "~1.6.18",
|
|
||||||
"utils-merge": "1.0.1",
|
|
||||||
"vary": "~1.1.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"finalhandler": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
|
|
||||||
"integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
|
|
||||||
"requires": {
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"on-finished": "~2.3.0",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"statuses": "~1.5.0",
|
|
||||||
"unpipe": "~1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"forwarded": {
|
|
||||||
"version": "0.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
|
|
||||||
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
|
|
||||||
},
|
|
||||||
"fresh": {
|
|
||||||
"version": "0.5.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
|
||||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
|
|
||||||
},
|
|
||||||
"http-errors": {
|
|
||||||
"version": "1.7.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
|
|
||||||
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
|
|
||||||
"requires": {
|
|
||||||
"depd": "~1.1.2",
|
|
||||||
"inherits": "2.0.3",
|
|
||||||
"setprototypeof": "1.1.1",
|
|
||||||
"statuses": ">= 1.5.0 < 2",
|
|
||||||
"toidentifier": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"iconv-lite": {
|
|
||||||
"version": "0.4.24",
|
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
|
||||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
|
||||||
"requires": {
|
|
||||||
"safer-buffer": ">= 2.1.2 < 3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"inherits": {
|
|
||||||
"version": "2.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
|
||||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
|
||||||
},
|
|
||||||
"ipaddr.js": {
|
|
||||||
"version": "1.9.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
|
|
||||||
"integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA=="
|
|
||||||
},
|
|
||||||
"media-typer": {
|
|
||||||
"version": "0.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
|
||||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
|
||||||
},
|
|
||||||
"merge-descriptors": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
|
||||||
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
|
|
||||||
},
|
|
||||||
"methods": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
|
||||||
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
|
|
||||||
},
|
|
||||||
"mime": {
|
|
||||||
"version": "1.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
|
||||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
|
|
||||||
},
|
|
||||||
"mime-db": {
|
|
||||||
"version": "1.40.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
|
|
||||||
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
|
|
||||||
},
|
|
||||||
"mime-types": {
|
|
||||||
"version": "2.1.24",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
|
|
||||||
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
|
|
||||||
"requires": {
|
|
||||||
"mime-db": "1.40.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ms": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
|
||||||
},
|
|
||||||
"negotiator": {
|
|
||||||
"version": "0.6.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
|
|
||||||
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
|
|
||||||
},
|
|
||||||
"object-assign": {
|
|
||||||
"version": "4.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
|
||||||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
|
|
||||||
},
|
|
||||||
"on-finished": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
|
||||||
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
|
||||||
"requires": {
|
|
||||||
"ee-first": "1.1.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parseurl": {
|
|
||||||
"version": "1.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
|
||||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
|
|
||||||
},
|
|
||||||
"path-to-regexp": {
|
|
||||||
"version": "0.1.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
|
||||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
|
||||||
},
|
|
||||||
"proxy-addr": {
|
|
||||||
"version": "2.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz",
|
|
||||||
"integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==",
|
|
||||||
"requires": {
|
|
||||||
"forwarded": "~0.1.2",
|
|
||||||
"ipaddr.js": "1.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"qs": {
|
|
||||||
"version": "6.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
|
||||||
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
|
|
||||||
},
|
|
||||||
"range-parser": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
|
|
||||||
},
|
|
||||||
"raw-body": {
|
|
||||||
"version": "2.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
|
|
||||||
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
|
|
||||||
"requires": {
|
|
||||||
"bytes": "3.1.0",
|
|
||||||
"http-errors": "1.7.2",
|
|
||||||
"iconv-lite": "0.4.24",
|
|
||||||
"unpipe": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"safe-buffer": {
|
|
||||||
"version": "5.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
|
||||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
|
||||||
},
|
|
||||||
"safer-buffer": {
|
|
||||||
"version": "2.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
|
||||||
},
|
|
||||||
"send": {
|
|
||||||
"version": "0.17.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
|
|
||||||
"integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
|
|
||||||
"requires": {
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "~1.1.2",
|
|
||||||
"destroy": "~1.0.4",
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"etag": "~1.8.1",
|
|
||||||
"fresh": "0.5.2",
|
|
||||||
"http-errors": "~1.7.2",
|
|
||||||
"mime": "1.6.0",
|
|
||||||
"ms": "2.1.1",
|
|
||||||
"on-finished": "~2.3.0",
|
|
||||||
"range-parser": "~1.2.1",
|
|
||||||
"statuses": "~1.5.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ms": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"serve-static": {
|
|
||||||
"version": "1.14.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
|
|
||||||
"integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
|
|
||||||
"requires": {
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"send": "0.17.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"setprototypeof": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
|
|
||||||
},
|
|
||||||
"statuses": {
|
|
||||||
"version": "1.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
|
|
||||||
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
|
|
||||||
},
|
|
||||||
"toidentifier": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
|
|
||||||
},
|
|
||||||
"type-is": {
|
|
||||||
"version": "1.6.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
|
||||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
|
||||||
"requires": {
|
|
||||||
"media-typer": "0.3.0",
|
|
||||||
"mime-types": "~2.1.24"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"unpipe": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
|
|
||||||
},
|
|
||||||
"utils-merge": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
|
||||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
|
||||||
},
|
|
||||||
"vary": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
|
||||||
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
107
twistter-frontend/package-lock.json
generated
107
twistter-frontend/package-lock.json
generated
@@ -62,9 +62,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@material-ui/styles": {
|
"@material-ui/styles": {
|
||||||
"version": "4.4.3",
|
"version": "4.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.5.0.tgz",
|
||||||
"integrity": "sha512-kNUdHFWsrvWKIEPx8Xy2/qayqsGMrYmCMq+FIiJiYczVZl5hiS8j5+KayonnpVta/O+Dktk+cxWkVcgwtxMrHg==",
|
"integrity": "sha512-O0NSAECHK9f3DZK6wy56PZzp8b/7KSdfpJs8DSC7vnXUAoMPCTtchBKLzMtUsNlijiJFeJjSxNdQfjWXgyur5A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.4.4",
|
"@babel/runtime": "^7.4.4",
|
||||||
"@emotion/hash": "^0.7.1",
|
"@emotion/hash": "^0.7.1",
|
||||||
@@ -74,21 +74,21 @@
|
|||||||
"csstype": "^2.5.2",
|
"csstype": "^2.5.2",
|
||||||
"deepmerge": "^4.0.0",
|
"deepmerge": "^4.0.0",
|
||||||
"hoist-non-react-statics": "^3.2.1",
|
"hoist-non-react-statics": "^3.2.1",
|
||||||
"jss": "10.0.0-alpha.25",
|
"jss": "^10.0.0",
|
||||||
"jss-plugin-camel-case": "10.0.0-alpha.25",
|
"jss-plugin-camel-case": "^10.0.0",
|
||||||
"jss-plugin-default-unit": "10.0.0-alpha.25",
|
"jss-plugin-default-unit": "^10.0.0",
|
||||||
"jss-plugin-global": "10.0.0-alpha.25",
|
"jss-plugin-global": "^10.0.0",
|
||||||
"jss-plugin-nested": "10.0.0-alpha.25",
|
"jss-plugin-nested": "^10.0.0",
|
||||||
"jss-plugin-props-sort": "10.0.0-alpha.25",
|
"jss-plugin-props-sort": "^10.0.0",
|
||||||
"jss-plugin-rule-value-function": "10.0.0-alpha.25",
|
"jss-plugin-rule-value-function": "^10.0.0",
|
||||||
"jss-plugin-vendor-prefixer": "10.0.0-alpha.25",
|
"jss-plugin-vendor-prefixer": "^10.0.0",
|
||||||
"prop-types": "^15.7.2"
|
"prop-types": "^15.7.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@material-ui/system": {
|
"@material-ui/system": {
|
||||||
"version": "4.4.3",
|
"version": "4.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@material-ui/system/-/system-4.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/@material-ui/system/-/system-4.5.0.tgz",
|
||||||
"integrity": "sha512-Cb05vLXsaCzssXD/iZKa0/qC6YOwbFWnYdnOEdkXZ3Fn2Ytz7rsnMgFejUSQV1luVhUBlEIm8DVz40N25WwW7w==",
|
"integrity": "sha512-vR0PbMTzLnuuVCoYNQ13zyhLa/4s/UA9P9JbNuHBOOkfrHn53ShINiG0v05EgfwizfULLtc7mNvsGAgIyyp/hQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.4.4",
|
"@babel/runtime": "^7.4.4",
|
||||||
"deepmerge": "^4.0.0",
|
"deepmerge": "^4.0.0",
|
||||||
@@ -119,9 +119,9 @@
|
|||||||
"integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw=="
|
"integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw=="
|
||||||
},
|
},
|
||||||
"@types/react": {
|
"@types/react": {
|
||||||
"version": "16.9.3",
|
"version": "16.9.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.4.tgz",
|
||||||
"integrity": "sha512-Ogb2nSn+2qQv5opoCv7Ls5yFxtyrdUYxp5G+SWTrlGk7dmFKw331GiezCgEZj9U7QeXJi1CDtws9pdXU1zUL4g==",
|
"integrity": "sha512-ItGNmJvQ0IvWt8rbk5PLdpdQhvBVxAaXI9hDlx7UMd8Ie1iMIuwMNiKeTfmVN517CdplpyXvA22X4zm4jGGZnw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/prop-types": "*",
|
"@types/prop-types": "*",
|
||||||
"csstype": "^2.2.0"
|
"csstype": "^2.2.0"
|
||||||
@@ -454,9 +454,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is-buffer": {
|
"is-buffer": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
|
||||||
"integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw=="
|
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -5196,9 +5196,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jss": {
|
"jss": {
|
||||||
"version": "10.0.0-alpha.25",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/jss/-/jss-10.0.0-alpha.25.tgz",
|
"resolved": "https://registry.npmjs.org/jss/-/jss-10.0.0.tgz",
|
||||||
"integrity": "sha512-zqKnXv181B9vue2yYhmVhc+6ggbbxHF/33rjXfXEjaa22nOvknTI21QDfq3oZ8uCC50kcFp3Z8KU1ghUXdFvIA==",
|
"integrity": "sha512-TPpDFsiBjuERiL+dFDq8QCdiF9oDasPcNqCKLGCo/qED3fNYOQ8PX2lZhknyTiAt3tZrfOFbb0lbQ9lTjPZxsQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.3.1",
|
"@babel/runtime": "^7.3.1",
|
||||||
"csstype": "^2.6.5",
|
"csstype": "^2.6.5",
|
||||||
@@ -5207,69 +5207,69 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jss-plugin-camel-case": {
|
"jss-plugin-camel-case": {
|
||||||
"version": "10.0.0-alpha.25",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.0.0-alpha.25.tgz",
|
"resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.0.0.tgz",
|
||||||
"integrity": "sha512-J5ZEGDTy9ddqdTUPAF4SJQ25u5kiG1ORP8F+ZPEZAkkiMQJp+/Aol4I7xhTS2aW1Lhg8xNxdhdRfBi5yU7wOvg==",
|
"integrity": "sha512-yALDL00+pPR4FJh+k07A8FeDvfoPPuXU48HLy63enAubcVd3DnS+2rgqPXglHDGixIDVkCSXecl/l5GAMjzIbA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.3.1",
|
"@babel/runtime": "^7.3.1",
|
||||||
"hyphenate-style-name": "^1.0.3",
|
"hyphenate-style-name": "^1.0.3",
|
||||||
"jss": "10.0.0-alpha.25"
|
"jss": "10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jss-plugin-default-unit": {
|
"jss-plugin-default-unit": {
|
||||||
"version": "10.0.0-alpha.25",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.0.0-alpha.25.tgz",
|
"resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.0.0.tgz",
|
||||||
"integrity": "sha512-auOG459B+yEqkojgaXH02SYO9+xjmAxlmP+WbzhVpXqOFJ2CN/kaxd8P4NJZLdj3BQxHiM7WIyMVh786StE+EA==",
|
"integrity": "sha512-sURozIOdCtGg9ap18erQ+ijndAfEGtTaetxfU3H4qwC18Bi+fdvjlY/ahKbuu0ASs7R/+WKCP7UaRZOjUDMcdQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.3.1",
|
"@babel/runtime": "^7.3.1",
|
||||||
"jss": "10.0.0-alpha.25"
|
"jss": "10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jss-plugin-global": {
|
"jss-plugin-global": {
|
||||||
"version": "10.0.0-alpha.25",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.0.0-alpha.25.tgz",
|
"resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.0.0.tgz",
|
||||||
"integrity": "sha512-cS98Q8X8jwltuaBZd9eYuxMXxkUL+mJGl2Ok3/nmJzH9nLzj6i7kLxSoDtuJNqsRmbP7ogIXVozJUq9lUu2hlQ==",
|
"integrity": "sha512-80ofWKSQUo62bxLtRoTNe0kFPtHgUbAJeOeR36WEGgWIBEsXLyXOnD5KNnjPqG4heuEkz9eSLccjYST50JnI7Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.3.1",
|
"@babel/runtime": "^7.3.1",
|
||||||
"jss": "10.0.0-alpha.25"
|
"jss": "10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jss-plugin-nested": {
|
"jss-plugin-nested": {
|
||||||
"version": "10.0.0-alpha.25",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.0.0-alpha.25.tgz",
|
"resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.0.0.tgz",
|
||||||
"integrity": "sha512-7sk7/6mX1YTgXe+AyeD1zEyKTgIGbbhYtg+wWQcHJlE1flW2JHfcQ5mw84FgHcHQRQ8Dq3l9I3aEY51ev0J1Wg==",
|
"integrity": "sha512-waxxwl/po1hN3azTyixKnr8ReEqUv5WK7WsO+5AWB0bFndML5Yqnt8ARZ90HEg8/P6WlqE/AB2413TkCRZE8bA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.3.1",
|
"@babel/runtime": "^7.3.1",
|
||||||
"jss": "10.0.0-alpha.25",
|
"jss": "10.0.0",
|
||||||
"tiny-warning": "^1.0.2"
|
"tiny-warning": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jss-plugin-props-sort": {
|
"jss-plugin-props-sort": {
|
||||||
"version": "10.0.0-alpha.25",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.0.0-alpha.25.tgz",
|
"resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.0.0.tgz",
|
||||||
"integrity": "sha512-8B/6QLQuUX8cIlZbXdjEm5l0jCX4EgacYMcFJhdKwDKEZYeAghpgQQrCKl0/CYHW7iFge5wim67P+uL6QxMzyw==",
|
"integrity": "sha512-41mf22CImjwNdtOG3r+cdC8+RhwNm616sjHx5YlqTwtSJLyLFinbQC/a4PIFk8xqf1qpFH1kEAIw+yx9HaqZ3g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.3.1",
|
"@babel/runtime": "^7.3.1",
|
||||||
"jss": "10.0.0-alpha.25"
|
"jss": "10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jss-plugin-rule-value-function": {
|
"jss-plugin-rule-value-function": {
|
||||||
"version": "10.0.0-alpha.25",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.0.0-alpha.25.tgz",
|
"resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.0.0.tgz",
|
||||||
"integrity": "sha512-CQQtWO+/OZRGaFRBSGQUgAci9YlVtdoXcWQKBNo70tmpp+kaXKlFNCYaL3jmHbJHMiwKQYG2RYFQNIrwJ9SGmA==",
|
"integrity": "sha512-Jw+BZ8JIw1f12V0SERqGlBT1JEPWax3vuZpMym54NAXpPb7R1LYHiCTIlaJUyqvIfEy3kiHMtgI+r2whGgRIxQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.3.1",
|
"@babel/runtime": "^7.3.1",
|
||||||
"jss": "10.0.0-alpha.25"
|
"jss": "10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jss-plugin-vendor-prefixer": {
|
"jss-plugin-vendor-prefixer": {
|
||||||
"version": "10.0.0-alpha.25",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.0.0-alpha.25.tgz",
|
"resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.0.0.tgz",
|
||||||
"integrity": "sha512-5FXpB/TiwckbrkoDCmd27YsWCESl1K4hAX/oro2/geEXgnVQvDgQOf2eWCsjYO2K1lYPPXtskMfws/Q3eKmbYg==",
|
"integrity": "sha512-qslqvL0MUbWuzXJWdUxpj6mdNUX8jr4FFTo3aZnAT65nmzWL7g8oTr9ZxmTXXgdp7ANhS1QWE7036/Q2isFBpw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.3.1",
|
"@babel/runtime": "^7.3.1",
|
||||||
"css-vendor": "^2.0.6",
|
"css-vendor": "^2.0.6",
|
||||||
"jss": "10.0.0-alpha.25"
|
"jss": "10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jsx-ast-utils": {
|
"jsx-ast-utils": {
|
||||||
@@ -5277,6 +5277,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz",
|
||||||
"integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE="
|
"integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE="
|
||||||
},
|
},
|
||||||
|
"jwt-decode": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-2.2.0.tgz",
|
||||||
|
"integrity": "sha1-fYa9VmefWM5qhHBKZX3TkruoGnk="
|
||||||
|
},
|
||||||
"kind-of": {
|
"kind-of": {
|
||||||
"version": "3.2.2",
|
"version": "3.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
|
||||||
|
|||||||
@@ -4,10 +4,13 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@material-ui/core": "^4.4.3",
|
"@material-ui/core": "^4.4.3",
|
||||||
|
"@material-ui/styles": "^4.5.0",
|
||||||
|
"@material-ui/system": "^4.5.0",
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
"clsx": "^1.0.4",
|
"clsx": "^1.0.4",
|
||||||
"create-react-app": "^3.1.2",
|
"create-react-app": "^3.1.2",
|
||||||
"install": "^0.13.0",
|
"install": "^0.13.0",
|
||||||
|
"jwt-decode": "^2.2.0",
|
||||||
"node-pre-gyp": "^0.13.0",
|
"node-pre-gyp": "^0.13.0",
|
||||||
"react": "^16.9.0",
|
"react": "^16.9.0",
|
||||||
"react-dom": "^16.9.0",
|
"react-dom": "^16.9.0",
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
html,
|
||||||
|
body {
|
||||||
|
background-color: rgb(245, 245, 245);
|
||||||
|
}
|
||||||
.app {
|
.app {
|
||||||
font-family: "Segoe UI";
|
font-family: "Segoe UI";
|
||||||
font-size: large;
|
font-size: large;
|
||||||
@@ -22,7 +26,7 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.register {
|
.signup {
|
||||||
background-color: #1da1f2;
|
background-color: #1da1f2;
|
||||||
border: 1px solid #fff;
|
border: 1px solid #fff;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@@ -47,3 +51,4 @@
|
|||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
color: #1da1f2;
|
color: #1da1f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,79 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from "react";
|
||||||
|
import "./App.css";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
import './App.css';
|
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
|
||||||
|
import Navbar from "./components/layout/NavBar";
|
||||||
|
import jwtDecode from "jwt-decode";
|
||||||
|
|
||||||
import { BrowserRouter as Router } from 'react-router-dom';
|
// Redux
|
||||||
import Route from 'react-router-dom/Route';
|
import { Provider } from "react-redux";
|
||||||
import Navbar from './components/layout/NavBar';
|
import store from "./redux/store";
|
||||||
|
import MuiThemeProvider from '@material-ui/core/styles/MuiThemeProvider';
|
||||||
|
import createMuiTheme from '@material-ui/core/styles/createMuiTheme';
|
||||||
|
import themeObject from './util/theme';
|
||||||
|
import { SET_AUTHENTICATED } from './redux/types';
|
||||||
|
import { logoutUser, getUserData } from './redux/actions/userActions';
|
||||||
|
|
||||||
|
// Components
|
||||||
|
import AuthRoute from "./util/AuthRoute";
|
||||||
|
|
||||||
|
// Pages
|
||||||
import home from './pages/Home';
|
import home from './pages/Home';
|
||||||
import register from './pages/Register';
|
import signup from './pages/Signup';
|
||||||
import login from './pages/Login';
|
import login from './pages/Login';
|
||||||
import user from './pages/user';
|
import user from './pages/user';
|
||||||
|
import logout from './pages/Logout';
|
||||||
import writeMicroblog from './Writing_Microblogs.js';
|
import writeMicroblog from './Writing_Microblogs.js';
|
||||||
import edit from './pages/edit.js';
|
import editProfile from './pages/editProfile';
|
||||||
import userLine from './Userline.js';
|
import userLine from './Userline.js';
|
||||||
|
|
||||||
|
const theme = createMuiTheme(themeObject);
|
||||||
|
|
||||||
|
const token = localStorage.FBIdToken;
|
||||||
|
if (token) {
|
||||||
|
const decodedToken = jwtDecode(token);
|
||||||
|
if (decodedToken.exp * 1000 < Date.now()) {
|
||||||
|
store.dispatch(logoutUser);
|
||||||
|
window.location.href = "/login";
|
||||||
|
} else {
|
||||||
|
store.dispatch({ type: SET_AUTHENTICATED });
|
||||||
|
axios.defaults.headers.common['Authorization'] = token;
|
||||||
|
store.dispatch(getUserData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
<MuiThemeProvider theme={theme}>
|
||||||
|
<Provider store={store}>
|
||||||
<Router>
|
<Router>
|
||||||
<div className='container' >
|
<div className='container' >
|
||||||
<Navbar />
|
<Navbar />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="app">
|
<div className="app">
|
||||||
<Route exact path="/" component={home}/>
|
<Switch>
|
||||||
<Route exact path="/register" component={register}/>
|
{/* AuthRoute checks if the user is logged in and if they are it redirects them to /home */}
|
||||||
<Route exact path="/login" component={login}/>
|
<AuthRoute exact path="/signup" component={signup} />
|
||||||
<Route exact path="/user" component={user}/>
|
<AuthRoute exact path="/login" component={login} />
|
||||||
<Route exact path="/home" component={writeMicroblog}/>
|
<Route exact path="/logout" component={logout} />
|
||||||
<Route exact path="/edit" component={edit}/>
|
|
||||||
<Route exact path="/userline" component={userLine}/>
|
<Route exact path="/user" component={user} />
|
||||||
|
<Route exact path="/home" component={writeMicroblog} />
|
||||||
|
<Route exact path="/edit" component={editProfile} />
|
||||||
|
<Route exact path="/user" component={userLine} />
|
||||||
|
|
||||||
|
<AuthRoute exact path="/" component={home}/>
|
||||||
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</Router>
|
</Router>
|
||||||
|
</Provider>
|
||||||
|
</MuiThemeProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
import React, { Component} from 'react';
|
|
||||||
import './App.css';
|
|
||||||
import logo from './images/twistter-logo.png';
|
|
||||||
import TextField from '@material-ui/core/TextField';
|
|
||||||
|
|
||||||
class Logout extends Component {
|
|
||||||
render() {
|
|
||||||
return(
|
|
||||||
<div>
|
|
||||||
<img src={logo} className="app-logo" alt="logo" />
|
|
||||||
<br/><br/>
|
|
||||||
<b>Logout of your Twistter Account</b>
|
|
||||||
<br/><br/>
|
|
||||||
<br/><br/>
|
|
||||||
<button className="authButtons register" type="submit">Sign Out</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Logout;
|
|
||||||
@@ -23,7 +23,7 @@ class Userline extends Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
axios.get('http://localhost:5001/twistter-e4649/us-central1/api/getallPostsforUser')
|
axios.get('/getallPostsforUser')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const post = res.data;
|
const post = res.data;
|
||||||
this.setState({microBlogs : post})
|
this.setState({microBlogs : post})
|
||||||
|
|||||||
@@ -34,21 +34,27 @@ class Writing_Microblogs extends Component {
|
|||||||
|
|
||||||
handleSubmit(event) {
|
handleSubmit(event) {
|
||||||
// alert('A title for the microblog was inputted: ' + this.state.title + '\nA microblog was posted: ' + this.state.value);
|
// alert('A title for the microblog was inputted: ' + this.state.title + '\nA microblog was posted: ' + this.state.value);
|
||||||
|
const postData = {
|
||||||
const response = axios.post(
|
body: this.state.value,
|
||||||
'http://localhost:5001/twistter-e4649/us-central1/api/putPost',
|
|
||||||
{ body: this.state.value,
|
|
||||||
userHandle: "new user",
|
userHandle: "new user",
|
||||||
userImage: "bing-url",
|
userImage: "bing-url",
|
||||||
microBlogTitle: this.state.title,
|
microBlogTitle: this.state.title,
|
||||||
microBlogTopics: this.state.topics.split(', ')
|
microBlogTopics: this.state.topics.split(', ')
|
||||||
|
}
|
||||||
|
const headers = {
|
||||||
|
headers: { 'Content-Type': 'application/json'}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
axios
|
||||||
{ headers: { 'Content-Type': 'application/json'} }
|
.post('/putPost', postData, headers)
|
||||||
|
.then((res) =>{
|
||||||
)
|
alert('Post was shared successfully!')
|
||||||
console.log(response.data);
|
console.log(res.data);
|
||||||
alert('Post was shared successfully!');
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
alert('An error occured.');
|
||||||
|
console.error(err);
|
||||||
|
})
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.setState({value: '', title: '',characterCount: 250, topics: ''})
|
this.setState({value: '', title: '',characterCount: 250, topics: ''})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,42 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
// import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
// Material UI stuff
|
||||||
import AppBar from '@material-ui/core/AppBar';
|
import AppBar from '@material-ui/core/AppBar';
|
||||||
import ToolBar from '@material-ui/core/Toolbar';
|
import ToolBar from '@material-ui/core/Toolbar';
|
||||||
import Button from '@material-ui/core/Button';
|
import Button from '@material-ui/core/Button';
|
||||||
|
import withStyles from "@material-ui/core/styles/withStyles";
|
||||||
|
|
||||||
export class Navbar extends Component {
|
// Redux stuff
|
||||||
|
// import { logoutUser } from '../../redux/actions/userActions';
|
||||||
|
// import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
// const styles = {
|
||||||
|
// form: {
|
||||||
|
// textAlign: "center"
|
||||||
|
// },
|
||||||
|
// textField: {
|
||||||
|
// marginBottom: 30
|
||||||
|
// },
|
||||||
|
// pageTitle: {
|
||||||
|
// marginBottom: 40
|
||||||
|
// },
|
||||||
|
// button: {
|
||||||
|
// positon: "relative",
|
||||||
|
// marginBottom: 30
|
||||||
|
// },
|
||||||
|
// progress: {
|
||||||
|
// position: "absolute"
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export class Navbar extends Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<AppBar>
|
<AppBar>
|
||||||
@@ -16,8 +47,8 @@ export class Navbar extends Component {
|
|||||||
<Button component={ Link } to='/login'>
|
<Button component={ Link } to='/login'>
|
||||||
Login
|
Login
|
||||||
</Button>
|
</Button>
|
||||||
<Button component={ Link } to='/register'>
|
<Button component={ Link } to='/signup'>
|
||||||
Register
|
Sign Up
|
||||||
</Button>
|
</Button>
|
||||||
<Button component={ Link } to='/logout'>
|
<Button component={ Link } to='/logout'>
|
||||||
Logout
|
Logout
|
||||||
@@ -28,4 +59,18 @@ export class Navbar extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// const mapStateToProps = (state) => ({
|
||||||
|
// user: state.user
|
||||||
|
// })
|
||||||
|
|
||||||
|
// const mapActionsToProps = { logoutUser };
|
||||||
|
|
||||||
|
// Navbar.propTypes = {
|
||||||
|
// logoutUser: PropTypes.func.isRequired,
|
||||||
|
// user: PropTypes.object.isRequired,
|
||||||
|
// classes: PropTypes.object.isRequired
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export default connect(mapStateToProps, mapActionsToProps)(withStyles(styles)(Navbar));
|
||||||
|
|
||||||
export default Navbar;
|
export default Navbar;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
import * as serviceWorker from './serviceWorker';
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<App />,
|
<App />,
|
||||||
document.getElementById('root')
|
document.getElementById('root')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
serviceWorker.unregister();
|
||||||
@@ -21,8 +21,8 @@ class Home extends Component {
|
|||||||
<div>
|
<div>
|
||||||
<b>Join today or sign in if you already have an account.</b>
|
<b>Join today or sign in if you already have an account.</b>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<form action="./register">
|
<form action="./signup">
|
||||||
<button className="authButtons register">Sign up</button>
|
<button className="authButtons signup">Sign up</button>
|
||||||
</form>
|
</form>
|
||||||
<br/>
|
<br/>
|
||||||
<form action="./login">
|
<form action="./login">
|
||||||
|
|||||||
@@ -1,26 +1,184 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import '../App.css';
|
// import '../App.css';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import logo from '../images/twistter-logo.png';
|
import logo from '../images/twistter-logo.png';
|
||||||
import TextField from '@material-ui/core/TextField';
|
|
||||||
|
|
||||||
class Login extends Component {
|
// Material-UI stuff
|
||||||
render() {
|
import Button from "@material-ui/core/Button";
|
||||||
return (
|
import CircularProgress from "@material-ui/core/CircularProgress";
|
||||||
<div>
|
import Grid from "@material-ui/core/Grid";
|
||||||
<img src={logo} className="app-logo" alt="logo" />
|
import TextField from "@material-ui/core/TextField";
|
||||||
<br/><br/>
|
import Typography from "@material-ui/core/Typography";
|
||||||
<b>Log in to Twistter</b>
|
import withStyles from "@material-ui/core/styles/withStyles";
|
||||||
<br/><br/>
|
|
||||||
<TextField className="authInput" id="email" name="email" label="Email" />
|
// Redux stuff
|
||||||
<br/><br/>
|
import { connect } from 'react-redux';
|
||||||
<TextField className="authInput" id="password" name="password" label="Password" />
|
import { loginUser } from '../redux/actions/userActions';
|
||||||
<br/><br/>
|
|
||||||
<button className="authButtons register" type="submit">Sign in</button>
|
const styles = {
|
||||||
</div>
|
form: {
|
||||||
);
|
textAlign: "center"
|
||||||
|
},
|
||||||
|
textField: {
|
||||||
|
marginBottom: 30
|
||||||
|
},
|
||||||
|
pageTitle: {
|
||||||
|
// marginTop: 20,
|
||||||
|
marginBottom: 40
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
positon: "relative",
|
||||||
|
marginBottom: 30
|
||||||
|
},
|
||||||
|
progress: {
|
||||||
|
position: "absolute"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export class Login extends Component {
|
||||||
|
// componentDidMount() {
|
||||||
|
// axios
|
||||||
|
// .get("/getProfileInfo")
|
||||||
|
// .then((res) => {
|
||||||
|
// this.setState({
|
||||||
|
// firstName: res.data.firstName,
|
||||||
|
// lastName: res.data.lastName,
|
||||||
|
// email: res.data.email,
|
||||||
|
// handle: res.data.handle,
|
||||||
|
// bio: res.data.bio
|
||||||
|
// });
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// console.error(err);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Constructor for the state
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
email: "",
|
||||||
|
password:"",
|
||||||
|
errors: {}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if (nextProps.UI.errors) {
|
||||||
|
this.setState({ errors: nextProps.UI.errors });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Runs whenever the submit button is clicked.
|
||||||
|
// Updates the database entry of the signed in user with the
|
||||||
|
// data stored in the state.
|
||||||
|
handleSubmit = (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const loginData = {
|
||||||
|
email: this.state.email,
|
||||||
|
password: this.state.password,
|
||||||
|
};
|
||||||
|
this.props.loginUser(loginData, this.props.history);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Updates the state whenever one of the textboxes changes.
|
||||||
|
// The key is the name of the textbox and the value is the
|
||||||
|
// value in the text box.
|
||||||
|
handleChange = (event) => {
|
||||||
|
this.setState({
|
||||||
|
[event.target.name]: event.target.value,
|
||||||
|
errors: {
|
||||||
|
[event.target.name]: null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { classes, UI: { loading } } = this.props;
|
||||||
|
const { errors } = this.state;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Grid container className={classes.form}>
|
||||||
|
<Grid item sm />
|
||||||
|
<Grid item sm>
|
||||||
|
<img src={logo} className="app-logo" alt="logo" />
|
||||||
|
<Typography variant="h2" className={classes.pageTitle}>
|
||||||
|
Log in to Twistter
|
||||||
|
</Typography>
|
||||||
|
<form noValidate onSubmit={this.handleSubmit}>
|
||||||
|
<TextField
|
||||||
|
id="email"
|
||||||
|
name="email"
|
||||||
|
label="Email*"
|
||||||
|
className={classes.textField}
|
||||||
|
value={this.state.email}
|
||||||
|
helperText={errors.email}
|
||||||
|
error={errors.email ? true : false}
|
||||||
|
variant="outlined"
|
||||||
|
onChange={this.handleChange}
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
id="password"
|
||||||
|
name="password"
|
||||||
|
label="Password*"
|
||||||
|
className={classes.textField}
|
||||||
|
value={this.state.password}
|
||||||
|
helperText={errors.password}
|
||||||
|
error={errors.password ? true : false}
|
||||||
|
type="password"
|
||||||
|
variant="outlined"
|
||||||
|
onChange={this.handleChange}
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
className={classes.button}
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
|
Login
|
||||||
|
{loading && (
|
||||||
|
<CircularProgress size={30} className={classes.progress} />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
{errors.general && (
|
||||||
|
<Typography color="error">Wrong Email or Password</Typography>
|
||||||
|
)}
|
||||||
|
</form>
|
||||||
|
</Grid>
|
||||||
|
<Grid item sm />
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Login;
|
// Proptypes just confirms that all data in it exists and is of the type that it
|
||||||
|
// is declared to be
|
||||||
|
Login.propTypes = {
|
||||||
|
classes: PropTypes.object.isRequired,
|
||||||
|
loginUser: PropTypes.func.isRequired,
|
||||||
|
user: PropTypes.object.isRequired,
|
||||||
|
UI: PropTypes.object.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapStateToProps = (state) => ({
|
||||||
|
user: state.user,
|
||||||
|
UI: state.UI,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapActionsToProps = {
|
||||||
|
loginUser
|
||||||
|
}
|
||||||
|
|
||||||
|
Login.propTypes = {
|
||||||
|
classes: PropTypes.object.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
// This mapStateToProps is just synchronizing the 'state' to 'this.props' so we can access it
|
||||||
|
// The state contains info about the current logged in user
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapActionsToProps)(withStyles(styles)(Login));
|
||||||
|
|||||||
56
twistter-frontend/src/pages/Logout.js
Normal file
56
twistter-frontend/src/pages/Logout.js
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import React, { Component } from "react";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
// Material UI stuff
|
||||||
|
import Button from "@material-ui/core/Button";
|
||||||
|
import withStyles from "@material-ui/core/styles/withStyles";
|
||||||
|
|
||||||
|
// Redux stuff
|
||||||
|
import { logoutUser } from "../redux/actions/userActions";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
|
||||||
|
const styles = {
|
||||||
|
form: {
|
||||||
|
textAlign: "center"
|
||||||
|
},
|
||||||
|
textField: {
|
||||||
|
marginBottom: 30
|
||||||
|
},
|
||||||
|
pageTitle: {
|
||||||
|
marginBottom: 40
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
positon: "relative",
|
||||||
|
marginBottom: 30
|
||||||
|
},
|
||||||
|
progress: {
|
||||||
|
position: "absolute"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export class Logout extends Component {
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.props.logoutUser();
|
||||||
|
this.props.history.push('/');
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapStateToProps = (state) => ({
|
||||||
|
user: state.user
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapActionsToProps = { logoutUser };
|
||||||
|
|
||||||
|
Logout.propTypes = {
|
||||||
|
logoutUser: PropTypes.func.isRequired,
|
||||||
|
user: PropTypes.object.isRequired,
|
||||||
|
classes: PropTypes.object.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapActionsToProps)(withStyles(styles)(Logout));
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import React, { Component } from 'react';
|
|
||||||
import '../App.css';
|
|
||||||
|
|
||||||
import logo from '../images/twistter-logo.png';
|
|
||||||
import TextField from '@material-ui/core/TextField';
|
|
||||||
|
|
||||||
class Register extends Component {
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<img src={logo} className="app-logo" alt="logo" />
|
|
||||||
<br/><br/>
|
|
||||||
<b>Create your account</b>
|
|
||||||
<br/><br/>
|
|
||||||
<TextField className="authInput" id="email" name="email" label="Email" />
|
|
||||||
<br/><br/>
|
|
||||||
<TextField className="authInput" id="username" name="username" label="Username" />
|
|
||||||
<br/><br/>
|
|
||||||
<TextField className="authInput" id="password" name="password" label="Password" />
|
|
||||||
<br/><br/>
|
|
||||||
<TextField className="authInput" id="confirmPassword" name="confirmPassword" label="Confirm Password" />
|
|
||||||
<br/><br/>
|
|
||||||
<button class="authButtons register" id="submit">Sign up</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Register;
|
|
||||||
197
twistter-frontend/src/pages/Signup.js
Normal file
197
twistter-frontend/src/pages/Signup.js
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
// import '../App.css';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
import logo from '../images/twistter-logo.png';
|
||||||
|
|
||||||
|
// Material-UI stuff
|
||||||
|
import Button from "@material-ui/core/Button";
|
||||||
|
import CircularProgress from "@material-ui/core/CircularProgress";
|
||||||
|
import Grid from "@material-ui/core/Grid";
|
||||||
|
import TextField from "@material-ui/core/TextField";
|
||||||
|
import Typography from "@material-ui/core/Typography";
|
||||||
|
import withStyles from "@material-ui/core/styles/withStyles";
|
||||||
|
|
||||||
|
// Redux stuff
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { signupUser } from '../redux/actions/userActions';
|
||||||
|
|
||||||
|
const styles = {
|
||||||
|
form: {
|
||||||
|
textAlign: "center"
|
||||||
|
},
|
||||||
|
textField: {
|
||||||
|
marginBottom: 30
|
||||||
|
},
|
||||||
|
pageTitle: {
|
||||||
|
marginBottom: 40
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
positon: "relative",
|
||||||
|
marginBottom: 30
|
||||||
|
},
|
||||||
|
progress: {
|
||||||
|
position: "absolute"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export class Signup extends Component {
|
||||||
|
|
||||||
|
// Constructor for the state
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
handle: "",
|
||||||
|
email: "",
|
||||||
|
password:"",
|
||||||
|
confirmPassword: "",
|
||||||
|
errors: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if (nextProps.UI.errors) {
|
||||||
|
this.setState({ errors: nextProps.UI.errors });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Runs whenever the submit button is clicked.
|
||||||
|
// Updates the database entry of the signed in user with the
|
||||||
|
// data stored in the state.
|
||||||
|
handleSubmit = (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const signupData = {
|
||||||
|
handle: this.state.handle,
|
||||||
|
email: this.state.email,
|
||||||
|
password: this.state.password,
|
||||||
|
confirmPassword: this.state.confirmPassword
|
||||||
|
};
|
||||||
|
console.log(signupData)
|
||||||
|
this.props.signupUser(signupData, this.props.history);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Updates the state whenever one of the textboxes changes.
|
||||||
|
// The key is the name of the textbox and the value is the
|
||||||
|
// value in the text box.
|
||||||
|
handleChange = (event) => {
|
||||||
|
this.setState({
|
||||||
|
[event.target.name]: event.target.value,
|
||||||
|
errors: {
|
||||||
|
[event.target.name]: null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { classes, UI: { loading } } = this.props;
|
||||||
|
const { errors } = this.state;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Grid container className={classes.form}>
|
||||||
|
<Grid item sm />
|
||||||
|
<Grid item sm>
|
||||||
|
<img src={logo} className="app-logo" alt="logo" />
|
||||||
|
<Typography variant="h2" className={classes.pageTitle}>
|
||||||
|
Create a new account
|
||||||
|
</Typography>
|
||||||
|
<form noValidate onSubmit={this.handleSubmit}>
|
||||||
|
<TextField
|
||||||
|
id="handle"
|
||||||
|
name="handle"
|
||||||
|
label="Username*"
|
||||||
|
className={classes.textField}
|
||||||
|
value={this.state.handle}
|
||||||
|
helperText={errors.handle}
|
||||||
|
error={errors.handle ? true : false}
|
||||||
|
variant="outlined"
|
||||||
|
onChange={this.handleChange}
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
id="email"
|
||||||
|
name="email"
|
||||||
|
label="Email*"
|
||||||
|
className={classes.textField}
|
||||||
|
value={this.state.email}
|
||||||
|
helperText={errors.email}
|
||||||
|
error={errors.email ? true : false}
|
||||||
|
variant="outlined"
|
||||||
|
onChange={this.handleChange}
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
id="password"
|
||||||
|
name="password"
|
||||||
|
label="Password*"
|
||||||
|
className={classes.textField}
|
||||||
|
value={this.state.password}
|
||||||
|
helperText={errors.password}
|
||||||
|
error={errors.password ? true : false}
|
||||||
|
type="password"
|
||||||
|
variant="outlined"
|
||||||
|
onChange={this.handleChange}
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
id="confirmPassword"
|
||||||
|
name="confirmPassword"
|
||||||
|
label="Confirm Password*"
|
||||||
|
className={classes.textField}
|
||||||
|
value={this.state.confirmPassword}
|
||||||
|
helperText={errors.confirmPassword}
|
||||||
|
error={errors.confirmPassword ? true : false}
|
||||||
|
type="password"
|
||||||
|
variant="outlined"
|
||||||
|
onChange={this.handleChange}
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
className={classes.button}
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
|
Sign Up
|
||||||
|
{loading && (
|
||||||
|
<CircularProgress size={30} className={classes.progress} />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
{errors.general && (
|
||||||
|
<Typography color="error">Wrong Email or Password</Typography>
|
||||||
|
)}
|
||||||
|
</form>
|
||||||
|
</Grid>
|
||||||
|
<Grid item sm />
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proptypes just confirms that all data in it exists and is of the type that it
|
||||||
|
// is declared to be
|
||||||
|
Signup.propTypes = {
|
||||||
|
classes: PropTypes.object.isRequired,
|
||||||
|
signupUser: PropTypes.func.isRequired,
|
||||||
|
user: PropTypes.object.isRequired,
|
||||||
|
UI: PropTypes.object.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapStateToProps = (state) => ({
|
||||||
|
user: state.user,
|
||||||
|
UI: state.UI,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapActionsToProps = {
|
||||||
|
signupUser
|
||||||
|
}
|
||||||
|
|
||||||
|
Signup.propTypes = {
|
||||||
|
classes: PropTypes.object.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
// This mapStateToProps is just synchronizing the 'state' to 'this.props' so we can access it
|
||||||
|
// The state contains info about the current logged in user
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapActionsToProps)(withStyles(styles)(Signup));
|
||||||
@@ -50,6 +50,12 @@ export class edit extends Component {
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
if (err.response.status === 403) {
|
||||||
|
alert("You are not logged in");
|
||||||
|
// TODO: Redirect them, to the profile they are trying to edit
|
||||||
|
// If they are on /itsjimmy/edit, they will be redirected to /itsjimmy
|
||||||
|
this.props.history.push('../');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +91,7 @@ export class edit extends Component {
|
|||||||
axios
|
axios
|
||||||
.post("/updateProfileInfo", newProfileData)
|
.post("/updateProfileInfo", newProfileData)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false
|
loading: false
|
||||||
});
|
});
|
||||||
@@ -92,6 +99,7 @@ export class edit extends Component {
|
|||||||
// TODO: Need to redirect user to their profile page
|
// TODO: Need to redirect user to their profile page
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
this.setState({
|
this.setState({
|
||||||
errors: err.response.data,
|
errors: err.response.data,
|
||||||
loading: false
|
loading: false
|
||||||
@@ -102,6 +110,7 @@ export class edit extends Component {
|
|||||||
// Updates the state whenever one of the textboxes changes.
|
// Updates the state whenever one of the textboxes changes.
|
||||||
// The key is the name of the textbox and the value is the
|
// The key is the name of the textbox and the value is the
|
||||||
// value in the text box.
|
// value in the text box.
|
||||||
|
// Also sets errors to null of textboxes that have been edited
|
||||||
handleChange = (event) => {
|
handleChange = (event) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
[event.target.name]: event.target.value,
|
[event.target.name]: event.target.value,
|
||||||
@@ -1,40 +1,49 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import axios from 'axios';
|
||||||
import StaticProfile from '../components/profile/StaticProfile';
|
//import '../App.css';
|
||||||
|
import { makeStyles, styled } from '@material-ui/core/styles';
|
||||||
import Grid from '@material-ui/core/Grid';
|
import Grid from '@material-ui/core/Grid';
|
||||||
|
import Card from '@material-ui/core/Card';
|
||||||
|
import CardMedia from '@material-ui/core/CardMedia';
|
||||||
|
import CardContent from '@material-ui/core/CardContent';
|
||||||
|
import Chip from '@material-ui/core/Chip';
|
||||||
|
import Paper from '@material-ui/core/Paper';
|
||||||
|
|
||||||
import PostSkeleton from '../util/PostSkeleton';
|
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
const PostCard = styled(Card)({
|
||||||
|
background: 'linear-gradient(45deg, #1da1f2 90%)',
|
||||||
|
border: 3,
|
||||||
|
borderRadius: 3,
|
||||||
|
height:325,
|
||||||
|
width: 345,
|
||||||
|
padding: '0 30px',
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
class user extends Component {
|
class user extends Component {
|
||||||
render() {
|
componentDidMount(){
|
||||||
const postMarkup = PostSkeleton;
|
//TODO: get user details
|
||||||
|
//TODO: get posts
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
return (
|
return (
|
||||||
<b>User page</b>
|
<Grid container spacing={16}>
|
||||||
// <Grid container spacing={16}>
|
<Grid item sm={8} xs={12}>
|
||||||
// <Grid item sm={8} xs={12}>
|
<p>Post</p>
|
||||||
// <b>postMarkup</b>
|
</Grid>
|
||||||
// {postMarkup}
|
<Grid item sm={4} xs={12}>
|
||||||
// </Grid>
|
<PostCard>
|
||||||
// {/* <Grid item sm={4} xs={12}>
|
<CardMedia image="./no-img-png" />
|
||||||
// <StaticProfile profile={this.state.profile} />
|
<CardContent>Username</CardContent>
|
||||||
// </Grid> */}
|
</PostCard>
|
||||||
// </Grid>
|
</Grid>
|
||||||
)
|
</Grid>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user.propTypes = {
|
|
||||||
// getUserData: PropTypes.func.isRequired,
|
|
||||||
//data: PropTypes.object.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
|
||||||
data: state.data
|
|
||||||
});
|
|
||||||
|
|
||||||
export default connect(user);
|
export default user;
|
||||||
|
|||||||
0
twistter-frontend/src/redux/actions/dataActions.js
Normal file
0
twistter-frontend/src/redux/actions/dataActions.js
Normal file
68
twistter-frontend/src/redux/actions/userActions.js
Normal file
68
twistter-frontend/src/redux/actions/userActions.js
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
import {SET_USER, SET_ERRORS, CLEAR_ERRORS, LOADING_UI, SET_AUTHENTICATED, SET_UNAUTHENTICATED} from '../types';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
|
||||||
|
export const getUserData = () => (dispatch) => {
|
||||||
|
axios.get('/user')
|
||||||
|
.then((res) => {
|
||||||
|
dispatch({
|
||||||
|
type: SET_USER,
|
||||||
|
payload: res.data,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((err) => console.error(err));
|
||||||
|
}
|
||||||
|
|
||||||
|
export const loginUser = (loginData, history) => (dispatch) => {
|
||||||
|
dispatch({ type: LOADING_UI });
|
||||||
|
axios
|
||||||
|
.post("/login", loginData)
|
||||||
|
.then((res) => {
|
||||||
|
// Save the login token
|
||||||
|
setAuthorizationHeader(res.data.token);
|
||||||
|
dispatch(getUserData());
|
||||||
|
dispatch({ type: CLEAR_ERRORS })
|
||||||
|
// Redirects to home page
|
||||||
|
history.push('/home');
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
dispatch ({
|
||||||
|
type: SET_ERRORS,
|
||||||
|
payload: err.response.data,
|
||||||
|
})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const signupUser = (newUserData, history) => (dispatch) => {
|
||||||
|
dispatch({ type: LOADING_UI });
|
||||||
|
axios
|
||||||
|
.post("/signup", newUserData)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
console.log(res.data);
|
||||||
|
// Save the signup token
|
||||||
|
setAuthorizationHeader(res.data.token);
|
||||||
|
dispatch(getUserData());
|
||||||
|
dispatch({ type: CLEAR_ERRORS })
|
||||||
|
// Redirects to home page
|
||||||
|
history.push('/home');
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
dispatch ({
|
||||||
|
type: SET_ERRORS,
|
||||||
|
payload: err.response.data,
|
||||||
|
})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const logoutUser = () => (dispatch) => {
|
||||||
|
localStorage.removeItem('FBIdToken');
|
||||||
|
delete axios.defaults.headers.common['Authorization'];
|
||||||
|
dispatch({ type: SET_UNAUTHENTICATED });
|
||||||
|
}
|
||||||
|
|
||||||
|
const setAuthorizationHeader = (token) => {
|
||||||
|
const FBIdToken = `Bearer ${token}`;
|
||||||
|
localStorage.setItem('FBIdToken', FBIdToken);
|
||||||
|
axios.defaults.headers.common['Authorization'] = FBIdToken;
|
||||||
|
}
|
||||||
0
twistter-frontend/src/redux/reducers/dataReducer.js
Normal file
0
twistter-frontend/src/redux/reducers/dataReducer.js
Normal file
30
twistter-frontend/src/redux/reducers/uiReducer.js
Normal file
30
twistter-frontend/src/redux/reducers/uiReducer.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { SET_ERRORS, CLEAR_ERRORS, LOADING_UI } from '../types';
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
loading: false,
|
||||||
|
errors: null
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function(state = initialState, action) {
|
||||||
|
switch(action.type) {
|
||||||
|
case SET_ERRORS:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
errors: action.payload
|
||||||
|
};
|
||||||
|
case CLEAR_ERRORS:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
errors: null
|
||||||
|
};
|
||||||
|
case LOADING_UI:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
28
twistter-frontend/src/redux/reducers/userReducer.js
Normal file
28
twistter-frontend/src/redux/reducers/userReducer.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import {SET_USER, SET_ERRORS, CLEAR_ERRORS, LOADING_UI, SET_AUTHENTICATED, SET_UNAUTHENTICATED} from '../types';
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
authenticated: false,
|
||||||
|
credentials: {},
|
||||||
|
likes: [],
|
||||||
|
notifications: []
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function(state = initialState, action) {
|
||||||
|
switch(action.type) {
|
||||||
|
case SET_AUTHENTICATED:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
authenticated: true,
|
||||||
|
|
||||||
|
};
|
||||||
|
case SET_UNAUTHENTICATED:
|
||||||
|
return initialState;
|
||||||
|
case SET_USER:
|
||||||
|
return {
|
||||||
|
authenticated: true,
|
||||||
|
...action.payload,
|
||||||
|
};
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
28
twistter-frontend/src/redux/store.js
Normal file
28
twistter-frontend/src/redux/store.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { createStore, combineReducers, applyMiddleware, compose } from "redux";
|
||||||
|
import thunk from "redux-thunk";
|
||||||
|
|
||||||
|
import userReducer from "./reducers/userReducer";
|
||||||
|
import dataReducer from "./reducers/dataReducer";
|
||||||
|
import uiReducer from "./reducers/uiReducer";
|
||||||
|
|
||||||
|
const initialState = {};
|
||||||
|
|
||||||
|
const middleWare = [thunk];
|
||||||
|
|
||||||
|
const reducers = combineReducers({
|
||||||
|
user: userReducer,
|
||||||
|
data: dataReducer,
|
||||||
|
UI: uiReducer
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const store = createStore(
|
||||||
|
reducers,
|
||||||
|
initialState,
|
||||||
|
compose(
|
||||||
|
applyMiddleware(...middleWare),
|
||||||
|
window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f // Can be removed after debugging is finished
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
export default store;
|
||||||
12
twistter-frontend/src/redux/types.js
Normal file
12
twistter-frontend/src/redux/types.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// User reducer types
|
||||||
|
export const SET_AUTHENTICATED = 'SET_AUTHENTICATED';
|
||||||
|
export const SET_UNAUTHENTICATED = 'SET_UNAUTHENTICATED';
|
||||||
|
export const SET_USER = 'SET_USER';
|
||||||
|
export const LOADING_USER = 'LOADING_USER';
|
||||||
|
|
||||||
|
// UI reducer types
|
||||||
|
export const SET_ERRORS = 'SET_ERRORS';
|
||||||
|
export const LOADING_UI = 'LOADING_UI';
|
||||||
|
export const CLEAR_ERRORS = 'CLEAR_ERRORS';
|
||||||
|
|
||||||
|
// Data reducer types
|
||||||
135
twistter-frontend/src/serviceWorker.js
Normal file
135
twistter-frontend/src/serviceWorker.js
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
// This optional code is used to register a service worker.
|
||||||
|
// register() is not called by default.
|
||||||
|
|
||||||
|
// This lets the app load faster on subsequent visits in production, and gives
|
||||||
|
// it offline capabilities. However, it also means that developers (and users)
|
||||||
|
// will only see deployed updates on subsequent visits to a page, after all the
|
||||||
|
// existing tabs open on the page have been closed, since previously cached
|
||||||
|
// resources are updated in the background.
|
||||||
|
|
||||||
|
// To learn more about the benefits of this model and instructions on how to
|
||||||
|
// opt-in, read https://bit.ly/CRA-PWA
|
||||||
|
|
||||||
|
const isLocalhost = Boolean(
|
||||||
|
window.location.hostname === 'localhost' ||
|
||||||
|
// [::1] is the IPv6 localhost address.
|
||||||
|
window.location.hostname === '[::1]' ||
|
||||||
|
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||||
|
window.location.hostname.match(
|
||||||
|
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
export function register(config) {
|
||||||
|
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||||
|
// The URL constructor is available in all browsers that support SW.
|
||||||
|
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||||
|
if (publicUrl.origin !== window.location.origin) {
|
||||||
|
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||||
|
// from what our page is served on. This might happen if a CDN is used to
|
||||||
|
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||||
|
|
||||||
|
if (isLocalhost) {
|
||||||
|
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||||
|
checkValidServiceWorker(swUrl, config);
|
||||||
|
|
||||||
|
// Add some additional logging to localhost, pointing developers to the
|
||||||
|
// service worker/PWA documentation.
|
||||||
|
navigator.serviceWorker.ready.then(() => {
|
||||||
|
console.log(
|
||||||
|
'This web app is being served cache-first by a service ' +
|
||||||
|
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Is not localhost. Just register service worker
|
||||||
|
registerValidSW(swUrl, config);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function registerValidSW(swUrl, config) {
|
||||||
|
navigator.serviceWorker
|
||||||
|
.register(swUrl)
|
||||||
|
.then(registration => {
|
||||||
|
registration.onupdatefound = () => {
|
||||||
|
const installingWorker = registration.installing;
|
||||||
|
if (installingWorker == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
installingWorker.onstatechange = () => {
|
||||||
|
if (installingWorker.state === 'installed') {
|
||||||
|
if (navigator.serviceWorker.controller) {
|
||||||
|
// At this point, the updated precached content has been fetched,
|
||||||
|
// but the previous service worker will still serve the older
|
||||||
|
// content until all client tabs are closed.
|
||||||
|
console.log(
|
||||||
|
'New content is available and will be used when all ' +
|
||||||
|
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Execute callback
|
||||||
|
if (config && config.onUpdate) {
|
||||||
|
config.onUpdate(registration);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// At this point, everything has been precached.
|
||||||
|
// It's the perfect time to display a
|
||||||
|
// "Content is cached for offline use." message.
|
||||||
|
console.log('Content is cached for offline use.');
|
||||||
|
|
||||||
|
// Execute callback
|
||||||
|
if (config && config.onSuccess) {
|
||||||
|
config.onSuccess(registration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error during service worker registration:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkValidServiceWorker(swUrl, config) {
|
||||||
|
// Check if the service worker can be found. If it can't reload the page.
|
||||||
|
fetch(swUrl)
|
||||||
|
.then(response => {
|
||||||
|
// Ensure service worker exists, and that we really are getting a JS file.
|
||||||
|
const contentType = response.headers.get('content-type');
|
||||||
|
if (
|
||||||
|
response.status === 404 ||
|
||||||
|
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||||
|
) {
|
||||||
|
// No service worker found. Probably a different app. Reload the page.
|
||||||
|
navigator.serviceWorker.ready.then(registration => {
|
||||||
|
registration.unregister().then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Service worker found. Proceed as normal.
|
||||||
|
registerValidSW(swUrl, config);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
console.log(
|
||||||
|
'No internet connection found. App is running in offline mode.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unregister() {
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
navigator.serviceWorker.ready.then(registration => {
|
||||||
|
registration.unregister();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
23
twistter-frontend/src/util/AuthRoute.js
Normal file
23
twistter-frontend/src/util/AuthRoute.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Route, Redirect } from 'react-router-dom';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
const AuthRoute = ({ component: Component, authenticated, ...rest }) => (
|
||||||
|
<Route
|
||||||
|
{...rest}
|
||||||
|
render={(props) =>
|
||||||
|
authenticated === true ? <Redirect to="/home" /> : <Component {...props} />
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
const mapStateToProps = (state) => ({
|
||||||
|
authenticated: state.user.authenticated
|
||||||
|
});
|
||||||
|
|
||||||
|
AuthRoute.propTypes = {
|
||||||
|
user: PropTypes.object
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(mapStateToProps)(AuthRoute);
|
||||||
97
twistter-frontend/src/util/theme.js
Normal file
97
twistter-frontend/src/util/theme.js
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
export default {
|
||||||
|
palette: {
|
||||||
|
primary: {
|
||||||
|
light: '#1da1f2',
|
||||||
|
main: '#1da1f2',
|
||||||
|
dark: '#008394',
|
||||||
|
contrastText: '#fff'
|
||||||
|
},
|
||||||
|
secondary: {
|
||||||
|
light: '#ff6333',
|
||||||
|
main: '#ff3d00',
|
||||||
|
dark: '#b22a00',
|
||||||
|
contrastText: '#fff'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
typography: {
|
||||||
|
useNextVariants: true
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
textAlign: 'center'
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
margin: '20px auto 20px auto'
|
||||||
|
},
|
||||||
|
pageTitle: {
|
||||||
|
margin: '10px auto 10px auto'
|
||||||
|
},
|
||||||
|
textField: {
|
||||||
|
margin: '10px auto 10px auto'
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
marginTop: 20,
|
||||||
|
position: 'relative'
|
||||||
|
},
|
||||||
|
customError: {
|
||||||
|
color: 'red',
|
||||||
|
fontSize: '0.8rem',
|
||||||
|
marginTop: 10
|
||||||
|
},
|
||||||
|
progress: {
|
||||||
|
position: 'absolute'
|
||||||
|
},
|
||||||
|
invisibleSeparator: {
|
||||||
|
border: 'none',
|
||||||
|
margin: 4
|
||||||
|
},
|
||||||
|
visibleSeparator: {
|
||||||
|
width: '100%',
|
||||||
|
borderBottom: '1px solid rgba(0,0,0,0.1)',
|
||||||
|
marginBottom: 20
|
||||||
|
},
|
||||||
|
paper: {
|
||||||
|
padding: 20
|
||||||
|
},
|
||||||
|
profile: {
|
||||||
|
'& .image-wrapper': {
|
||||||
|
textAlign: 'center',
|
||||||
|
position: 'relative',
|
||||||
|
'& button': {
|
||||||
|
position: 'absolute',
|
||||||
|
top: '80%',
|
||||||
|
left: '70%'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'& .profile-image': {
|
||||||
|
width: 200,
|
||||||
|
height: 200,
|
||||||
|
objectFit: 'cover',
|
||||||
|
maxWidth: '100%',
|
||||||
|
borderRadius: '50%'
|
||||||
|
},
|
||||||
|
'& .profile-details': {
|
||||||
|
textAlign: 'center',
|
||||||
|
'& span, svg': {
|
||||||
|
verticalAlign: 'middle'
|
||||||
|
},
|
||||||
|
'& a': {
|
||||||
|
color: '#00bcd4'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'& hr': {
|
||||||
|
border: 'none',
|
||||||
|
margin: '0 0 10px 0'
|
||||||
|
},
|
||||||
|
'& svg.button': {
|
||||||
|
'&:hover': {
|
||||||
|
cursor: 'pointer'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
textAlign: 'center',
|
||||||
|
'& a': {
|
||||||
|
margin: '20px 10px'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user