From b33e9e72ba0db44e485e3ecf5c9b8352891c0e2d Mon Sep 17 00:00:00 2001 From: gorco Date: Tue, 9 Oct 2018 11:24:17 +0200 Subject: [PATCH] Fixed undefined var (lti launch url) in the new interface --- app/public/js/controllers/class.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/public/js/controllers/class.js b/app/public/js/controllers/class.js index 57671d7..1694afe 100644 --- a/app/public/js/controllers/class.js +++ b/app/public/js/controllers/class.js @@ -110,6 +110,9 @@ angular.module('classApp', ['ngStorage', 'services', 'ngAnimate', 'ngSanitize', }; $attrs.$observe('classid', function() { + var myPrefix = $location.$$absUrl.split('/')[5]; + $scope.lti.launch = $location.$$protocol + '://' + $location.$$host + ':' + $location.$$port + + '/api/login/launch/' + myPrefix + '/' + CONSTANTS.PREFIX; getClassInfo(); }); @@ -171,10 +174,6 @@ angular.module('classApp', ['ngStorage', 'services', 'ngAnimate', 'ngSanitize', $scope.lti.key = ''; $scope.lti.secret = ''; - var myPrefix = $location.$$path.split('/')[3]; - $scope.lti.launch = $location.$$protocol + '://' + $location.$$host + ':' + $location.$$port + - '/api/login/launch/' + myPrefix + '/' + CONSTANTS.PREFIX; - $scope.createLtiKey = function () { if ($scope.lti.secret) { $http.post(CONSTANTS.PROXY + '/lti', { @@ -182,6 +181,9 @@ angular.module('classApp', ['ngStorage', 'services', 'ngAnimate', 'ngSanitize', classId: $scope.class._id }).success(function (data) { $scope.lti.key = data._id; + var myPrefix = $location.$$absUrl.split('/')[5]; + $scope.lti.launch = $location.$$protocol + '://' + $location.$$host + ':' + $location.$$port + + '/api/login/launch/' + myPrefix + '/' + CONSTANTS.PREFIX; }).error(function (data, status) { console.error('Error on get /lti' + JSON.stringify(data) + ', status: ' + status); });