From 25e6d1baea735376ab9af0fb9e1d1a0eaef4b21b Mon Sep 17 00:00:00 2001 From: Kumar Priyansh Date: Fri, 31 May 2019 17:31:33 +0700 Subject: Updated Dashboard, Added Dashboard Functions, Added Login Check to Login and Dashboard Scripts --- dashboard/index.html | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++-- shared/Dashboard.js | 24 +++++++++++++++++++++++ 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 shared/Dashboard.js diff --git a/dashboard/index.html b/dashboard/index.html index e4a5f56..c16dcd0 100644 --- a/dashboard/index.html +++ b/dashboard/index.html @@ -4,9 +4,60 @@ - Firebase ECommerce Solution + Firebase ECommerce Solution - +
Some text some message..
+ + + + + \ No newline at end of file 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 -- cgit v1.2.3