diff options
Diffstat (limited to 'shared')
| -rw-r--r-- | shared/cart.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/shared/cart.js b/shared/cart.js index bc8f509..8393565 100644 --- a/shared/cart.js +++ b/shared/cart.js @@ -19,9 +19,30 @@ $(document).ready(function(){ showAlert("Failed to sign out") }); }) + + var user; + firebase.auth().onAuthStateChanged(function(user) { if (!user) { window.location.replace('../') } + user = firebase.auth().currentUser; + + console.log(user) + + //Checking if Cart is Empty + + var cartRef = firebase.database().ref('userCart/' + user.uid); + cartRef.on('value', function(snapshot) { + if(snapshot.val() === null) { + showEmptyCart(); + } + }); + }); + + + + + })
\ No newline at end of file |
