qa: Use relative addresses

This commit is contained in:
nemunaire 2020-09-09 19:50:39 +02:00
parent 5aa21d2679
commit 7c51ce7c4f

View File

@ -88,45 +88,45 @@ angular.module("FICApp")
angular.module("FICApp") angular.module("FICApp")
.factory("Version", function($resource) { .factory("Version", function($resource) {
return $resource("/api/version") return $resource("api/version")
}) })
.factory("Todo", function($resource) { .factory("Todo", function($resource) {
return $resource("/api/qa_work.json") return $resource("api/qa_work.json")
}) })
.factory("TodoWorked", function($resource) { .factory("TodoWorked", function($resource) {
return $resource("/api/qa_mywork.json") return $resource("api/qa_mywork.json")
}) })
.factory("Team", function($resource) { .factory("Team", function($resource) {
return $resource("/api/teams/:teamId", { teamId: '@id' }, { return $resource("api/teams/:teamId", { teamId: '@id' }, {
'update': {method: 'PUT'}, 'update': {method: 'PUT'},
}) })
}) })
.factory("Teams", function($resource) { .factory("Teams", function($resource) {
return $resource("/api/teams.json") return $resource("api/teams.json")
}) })
.factory("Theme", function($resource) { .factory("Theme", function($resource) {
return $resource("/api/themes/:themeId", { themeId: '@id' }, { return $resource("api/themes/:themeId", { themeId: '@id' }, {
update: {method: 'PUT'} update: {method: 'PUT'}
}); });
}) })
.factory("Themes", function($resource) { .factory("Themes", function($resource) {
return $resource("/api/themes.json", null, { return $resource("api/themes.json", null, {
'get': {method: 'GET'}, 'get': {method: 'GET'},
}) })
}) })
.factory("ThemedExercice", function($resource) { .factory("ThemedExercice", function($resource) {
return $resource("/api/themes/:themeId/exercices/:exerciceId", { themeId: '@id', exerciceId: '@idExercice' }, { return $resource("api/themes/:themeId/exercices/:exerciceId", { themeId: '@id', exerciceId: '@idExercice' }, {
update: {method: 'PUT'} update: {method: 'PUT'}
}) })
}) })
.factory("Exercice", function($resource) { .factory("Exercice", function($resource) {
return $resource("/api/exercices/:exerciceId", { exerciceId: '@id' }, { return $resource("api/exercices/:exerciceId", { exerciceId: '@id' }, {
update: {method: 'PUT'}, update: {method: 'PUT'},
patch: {method: 'PATCH'} patch: {method: 'PATCH'}
}) })
}) })
.factory("ExerciceQA", function($resource) { .factory("ExerciceQA", function($resource) {
return $resource("/api/qa/:exerciceId/:qaId", { exerciceId: '@idExercice', qaId: '@id' }, { return $resource("api/qa/:exerciceId/:qaId", { exerciceId: '@idExercice', qaId: '@id' }, {
update: {method: 'PUT'}, update: {method: 'PUT'},
patch: {method: 'PATCH'} patch: {method: 'PATCH'}
}) })
@ -267,7 +267,7 @@ angular.module("FICApp")
.controller("AllExercicesListController", function($scope, Exercice, Theme, $routeParams, $location, $rootScope, $http, $filter) { .controller("AllExercicesListController", function($scope, Exercice, Theme, $routeParams, $location, $rootScope, $http, $filter) {
$http({ $http({
url: "/api/themes.json", url: "api/themes.json",
method: "GET" method: "GET"
}).then(function(response) { }).then(function(response) {
$scope.themes = response.data $scope.themes = response.data
@ -320,7 +320,7 @@ angular.module("FICApp")
$scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId }); $scope.exercice = Exercice.get({ exerciceId: $routeParams.exerciceId });
} }
$http({ $http({
url: "/api/themes.json", url: "api/themes.json",
method: "GET" method: "GET"
}).then(function(response) { }).then(function(response) {
$scope.themes = response.data $scope.themes = response.data
@ -370,7 +370,7 @@ angular.module("FICApp")
} else { } else {
$scope.query_selected = qid $scope.query_selected = qid
$http({ $http({
url: "/api/qa/" + $routeParams.exerciceId + "/" + $scope.queries[$scope.query_selected].id + "/comments" url: "api/qa/" + $routeParams.exerciceId + "/" + $scope.queries[$scope.query_selected].id + "/comments"
}).then(function(response) { }).then(function(response) {
$scope.queries_comments = response.data $scope.queries_comments = response.data
}) })
@ -380,13 +380,13 @@ angular.module("FICApp")
$scope.newComment = {content: ""} $scope.newComment = {content: ""}
$scope.addComment = function() { $scope.addComment = function() {
$http({ $http({
url: "/api/qa/" + $routeParams.exerciceId + "/" + $scope.queries[$scope.query_selected].id + "/comments", url: "api/qa/" + $routeParams.exerciceId + "/" + $scope.queries[$scope.query_selected].id + "/comments",
method: "POST", method: "POST",
data: $scope.newComment, data: $scope.newComment,
}).then(function(response) { }).then(function(response) {
$scope.newComment = {content: ""} $scope.newComment = {content: ""}
$http({ $http({
url: "/api/qa/" + $routeParams.exerciceId + "/" + $scope.queries[$scope.query_selected].id + "/comments" url: "api/qa/" + $routeParams.exerciceId + "/" + $scope.queries[$scope.query_selected].id + "/comments"
}).then(function(response) { }).then(function(response) {
$scope.queries_comments = response.data $scope.queries_comments = response.data
}) })