From c580b8e6e81d97294d2168874757d43c76321987 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 9 Nov 2016 11:48:57 -0700 Subject: [PATCH] Adjustments to auth.js --- www/js/auth.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/www/js/auth.js b/www/js/auth.js index 55606cb..59f876d 100644 --- a/www/js/auth.js +++ b/www/js/auth.js @@ -51,12 +51,13 @@ function logout() { }); } +var teamchoosercheckretried = false; function checkUserHasTeamOpenChooserIfNot(username) { $.getJSON(mkApiUrl('getstats'), { user: username }, function (data) { if (data.status === 'OK') { - if (data.stats.teamid !== null && data.stats.teamid > 0) { + if (data.stats.teamid && data.stats.teamid > 0) { // We're all good. userteamid = data.stats.teamid; openscreen("home"); @@ -65,7 +66,13 @@ function checkUserHasTeamOpenChooserIfNot(username) { openscreen('chooseteam'); } } else { - serverProblemsDialog("Got a bad answer from the server. Restart the app and try again."); + // Might fix a strange bug that might not exist. + if (!teamchoosercheckretried) { + teamchoosercheckretried = true; + checkUserHasTeamOpenChooserIfNot(username); + } else { + serverProblemsDialog("Got a bad answer from the server. Restart the app and try again."); + } } }).fail(function () { serverProblemsDialog("Cannot get player data from server.");