1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 16:06:15 +00:00

Don't use OC.generateUrl to generate API endpoint URLs

OC.generateUrl doesn't permit to know applications endpoint for this app, instead use window.location.href to retrieve the app current URL and generate endpoints from this

This fixes issue #197
This commit is contained in:
Loic Blot 2017-08-16 17:58:13 +02:00
parent f70fc2c080
commit ca6ad6d071

View File

@ -105,7 +105,12 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
$scope.lastSearch = ''; $scope.lastSearch = '';
$scope.generateUrl = function (endpoint) { $scope.generateUrl = function (endpoint) {
return OC.generateUrl('/apps/ocsms' + endpoint); var winRegexp = /(.*)\/ocsms.*/;
var match = winRegexp.exec(window.location.href);
if (match.length != 2) {
console.log("A very bad error happened when parsing window location");
}
return match[1] + '/ocsms' + endpoint;
}; };
// Settings // Settings