This commit is contained in:
Michele Artini 2022-06-23 12:13:45 +02:00
parent bbcd58a353
commit 945dc44dde
2 changed files with 7 additions and 5 deletions

View File

@ -52,7 +52,7 @@ app.controller('vocabulariesController', function($scope, $http) {
$scope.deleteVocabulary = function(id) {
if (confirm("Are you sure ?")) {
$http.delete('./api/vocs/' + encodeURIComponent(id)).then(function successCallback(res) {
$http.delete('./api/vocs/' + encodeURIComponent(id) + '?' + $.now()).then(function successCallback(res) {
$scope.vocabularies = res.data;
alert("Vocabulary deleted");
}, function errorCallback(res) {

View File

@ -8,8 +8,10 @@ app.controller('vocabularyController', function($scope, $http, $location) {
$scope.mode = '';
$scope.currTerm = [];
$scope.baseUrl = './api/vocs/' + encodeURIComponent($scope.vocId) + '/terms';
$scope.reload = function() {
$http.get('./api/vocs/'+ encodeURIComponent($scope.vocId) + '/terms?' + $.now()).then(function successCallback(res) {
$http.get($scope.baseUrl + '?' + $.now()).then(function successCallback(res) {
$scope.terms = res.data;
}, function errorCallback(res) {
alert('ERROR: ' + res.data.message);
@ -40,12 +42,12 @@ app.controller('vocabularyController', function($scope, $http, $location) {
$scope.saveTerm = function(term) {
var url = './api/vocs/' + encodeURIComponent($scope.vocId) + '/terms';
var url = $scope.baseUrl + '?' + $.now();
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
$http.post(url, term).then(function successCallback(res) {
if ($scope.editTermCode != '' && $scope.editTermCode != $scope.tmpTerm.code) {
var deleteUrl = './api/vocs/' + encodeURIComponent($scope.vocId) + '/terms/' + encodeURIComponent($scope.editTermCode);
var deleteUrl = $scope.baseUrl + '/' + encodeURIComponent($scope.editTermCode) + '?' + $.now();
$http.delete(deleteUrl).then(function successCallback(res) {
$scope.terms = res.data;
alert("Term replaced");
@ -64,7 +66,7 @@ app.controller('vocabularyController', function($scope, $http, $location) {
$scope.deleteTerm = function(code) {
if (confirm("Are you sure ?")) {
var url = './api/vocs/' + encodeURIComponent($scope.vocId) + '/terms/' + encodeURIComponent(code);
var url = $scope.baseUrl + '/' + encodeURIComponent(code) + '?' + $.now();
$http.delete(url).then(function successCallback(res) {
$scope.terms = res.data;