VRFS-2610 : Fix bad API call that was throwing exception in console.

This commit is contained in:
Steven Miers 2015-01-06 17:14:33 -06:00
parent 405c155c71
commit 81ad2c89b5
3 changed files with 35 additions and 29 deletions

View File

@ -194,15 +194,17 @@
}
function handleGettingStarted(app) {
app.user()
.done(function(userProfile) {
if (userProfile.show_whats_next &&
window.location.pathname.indexOf(gon.client_path) == 0 &&
!app.layout.isDialogShowing('getting-started'))
{
app.layout.showDialog('getting-started');
}
})
var user = app.user()
if(user) {
user.done(function(userProfile) {
if (userProfile.show_whats_next &&
window.location.pathname.indexOf(gon.client_path) == 0 &&
!app.layout.isDialogShowing('getting-started'))
{
app.layout.showDialog('getting-started');
}
})
}
}
})(window, jQuery);

View File

@ -478,14 +478,16 @@
function getUserDetail(options) {
var id = getId(options);
var url = "/api/users/" + id;
return $.ajax({
type: "GET",
dataType: "json",
url: url,
processData: false
});
var detail = null;
if (id != null && typeof(id) != 'undefined') {
detail = $.ajax({
type: "GET",
dataType: "json",
url: "/api/users/" + id,
processData: false
});
}
return detail;
}
function getCities(options) {

View File

@ -362,20 +362,22 @@
this.layout.handleDialogState();
userDeferred = rest.getUserDetail();
userDeferred.done(this.updateUserCache)
if (userDeferred) {
userDeferred.done(this.updateUserCache)
if (opts.inClient) {
registerBadStateRecovered();
registerBadStateError();
registerDownloadAvailable();
registerDuplicateClientError();
context.JK.FaderHelpers.initialize();
context.window.onunload = this.unloadFunction;
if (opts.inClient) {
registerBadStateRecovered();
registerBadStateError();
registerDownloadAvailable();
registerDuplicateClientError();
context.JK.FaderHelpers.initialize();
context.window.onunload = this.unloadFunction;
userDeferred.fail(function(jqXHR) {
app.notify({title: "Unable to Load User", text: "You should reload the page."})
});
}
userDeferred.fail(function(jqXHR) {
app.notify({title: "Unable to Load User", text: "You should reload the page."})
});
}
} // if userDeferred
$(document).triggerHandler('JAMKAZAM_READY', {app:app})