Don't load map.js when there's no map, don't assume user chose correct account type

master
Skylar Ittner 5 years ago
parent 8a85055264
commit 46b0803343

@ -18,7 +18,7 @@ $(".view-main").on("card:open", ".card-expandable", function () {
});
$(".view-main").on("card:closed", "#map-card", function () {
//leafletgllayer._glMap.setPitch(0);
leafletgllayer._glMap.setPitch(0);
leafletmap.invalidateSize();
});
@ -46,7 +46,7 @@ function loadBalance(callback) {
}
function openMapCard() {
//leafletgllayer._glMap.setPitch(40);
leafletgllayer._glMap.setPitch(20);
leafletmap.invalidateSize();
}

@ -8,7 +8,7 @@ $('#username').on("keyup", function () {
$('#username').val($('#username').val().toLowerCase());
});
function checkAndSave(username, password, type) {
function checkAndSave(username, password) {
app.preloader.show();
callAPI("getkey", {
@ -19,10 +19,29 @@ function checkAndSave(username, password, type) {
localStorage.setItem("key", data.key);
localStorage.setItem("username", username);
localStorage.setItem("password", password);
localStorage.setItem("accttype", type);
localStorage.setItem("configured", true);
// Restart the app to re-read the config
restartApplication();
callAPI("getprofile", {
key: data.key
}, function (profile) {
if (profile.profile.type == 1) {
localStorage.setItem("accttype", "giver");
} else if (profile.profile.type == 2) {
localStorage.setItem("accttype", "receiver");
} else if (profile.profile.type == 3){
app.preloader.hide();
app.dialog.alert("You need to download the merchant app instead. Visit ntsm.co/contact if you need help.", "Error");
return;
} else {
app.preloader.hide();
app.dialog.alert("Server replied with unknown account type. You might need to update this app.", "Error");
return;
}
localStorage.setItem("configured", true);
// Restart the app to re-read the config
restartApplication();
}, function (msg) {
app.preloader.hide();
app.dialog.alert(msg, "Error");
});
}, function (msg) {
app.preloader.hide();
app.dialog.alert(msg, "Error");

@ -132,7 +132,9 @@
</a>
</div>
{{#if giver}}
<script src="js/map.js"></script>
{{/if}}
<script src="js/home.js"></script>
</div>
Loading…
Cancel
Save