aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/Dashboard.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/shared/Dashboard.js b/shared/Dashboard.js
new file mode 100644
index 0000000..84b8f7e
--- /dev/null
+++ b/shared/Dashboard.js
@@ -0,0 +1,24 @@
+$(document).ready(function(){
+ function showAlert(message) {
+ // Get the snackbar DIV
+ var x = document.getElementById("snackbar");
+ $('#snackbar').text(message)
+ // Add the "show" class to DIV
+ x.className = "show";
+
+ // After 3 seconds, remove the show class from DIV
+ setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
+ }
+ $('#signout').click(function(){
+ firebase.auth().signOut().then(function() {
+ window.location.replace('../')
+ }).catch(function(error) {
+ showAlert("Failed to sign out")
+ });
+ })
+ firebase.auth().onAuthStateChanged(function(user) {
+ if (!user) {
+ window.location.replace('../')
+ }
+ });
+}) \ No newline at end of file