From 290110274bce1b7b3b8efe26111a91aa3630666b Mon Sep 17 00:00:00 2001 From: Jacob Levine Date: Sat, 9 Feb 2019 13:32:06 -0600 Subject: [PATCH] even more of a last-ditch effort to make js not multithread everything --- website/public/profile/scripts.js | 35 +++++++++++-------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/website/public/profile/scripts.js b/website/public/profile/scripts.js index bbcac296..3a741a5c 100644 --- a/website/public/profile/scripts.js +++ b/website/public/profile/scripts.js @@ -13,29 +13,18 @@ function closeNav() { } window.onload = function() { - var promise1 = new Promise(function(resolve, reject) { - document.getElementById('sideload').style.display = 'block'; - var config = { - apiKey: "(insert the TitanScout Api Key Here)", - authDomain: "titanscoutandroid.firebaseapp.com", - databaseURL: "https://titanscoutandroid.firebaseio.com", - projectId: "titanscoutandroid", - storageBucket: "titanscoutandroid.appspot.com", - messagingSenderId: "1097635313476" - }; - //eventually find a less-jank way to do this tho - firebase.initializeApp(config); - promise2 = new Promise(function(resolve,reject){ - setTimeout(function(){ - user = firebase.auth().currentUser - resolve(user) - },10) - }); - promise2.then(function(user){ - resolve(user) - }) - }); - promise1.then(function(user) { + document.getElementById('sideload').style.display = 'block'; + var config = { + apiKey: "(insert the TitanScout Api Key Here)", + authDomain: "titanscoutandroid.firebaseapp.com", + databaseURL: "https://titanscoutandroid.firebaseio.com", + projectId: "titanscoutandroid", + storageBucket: "titanscoutandroid.appspot.com", + messagingSenderId: "1097635313476" + }; + //eventually find a less-jank way to do this tho + firebase.initializeApp(config); + firebase.auth().onAuthStateChanged(function(user) { if (user != null) { if (user.displayName != null) { document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName;