Don't try to get data when there's no user.

redesign-copyrights
Frode Petterson 2015-06-23 11:12:29 +02:00
parent d4ea0a1255
commit b9229ba75f
1 changed files with 6 additions and 0 deletions

View File

@ -1692,6 +1692,12 @@ H5P.createTitle = function (rawTitle, maxLength) {
* @param {boolean} [async=true] * @param {boolean} [async=true]
*/ */
function contentUserDataAjax(contentId, dataType, subContentId, done, data, preload, invalidate, async) { function contentUserDataAjax(contentId, dataType, subContentId, done, data, preload, invalidate, async) {
if (H5PIntegration.user === undefined) {
// Not logged in, no use in saving.
done('Not signed in.');
return;
}
var options = { var options = {
url: H5PIntegration.ajax.contentUserData.replace(':contentId', contentId).replace(':dataType', dataType).replace(':subContentId', subContentId ? subContentId : 0), url: H5PIntegration.ajax.contentUserData.replace(':contentId', contentId).replace(':dataType', dataType).replace(':subContentId', subContentId ? subContentId : 0),
dataType: 'json', dataType: 'json',