Skip to content
Snippets Groups Projects
Commit acb70e19 authored by Sven Kästle's avatar Sven Kästle
Browse files

refactor: Adjust front-end REST methods

parent fde69e0d
No related branches found
No related tags found
No related merge requests found
...@@ -12,12 +12,12 @@ $(document).ready(function() { ...@@ -12,12 +12,12 @@ $(document).ready(function() {
getAllSubmissionParts(getSubmissionIdFromUrl(), function (response) { getAllSubmissionParts(getSubmissionIdFromUrl(), function (response) {
// iterate over response // iterate over response
for (var i = 0; i < response.length; i++) { for (let i = 0; i < response.length; i++) {
// save current category and body // save current category and body
let category = response[i].category; let category = response[i].category;
let body = response[i].body; let body = response[i].body;
// iterate over body and handle every selection // iterate over body and handle every selection
for (var j = 0; j < body.length; j++) { for (let j = 0; j < body.length; j++) {
handleCategorySelection(category.toLowerCase(), body[j].startCharacter, body[j].endCharacter); handleCategorySelection(category.toLowerCase(), body[j].startCharacter, body[j].endCharacter);
} }
} }
......
...@@ -68,14 +68,15 @@ function createSubmissionPart(submissionPartPostRequest, responseHandler) { ...@@ -68,14 +68,15 @@ function createSubmissionPart(submissionPartPostRequest, responseHandler) {
} }
/** /**
* GET: Get a specific submission part for a given id * GET: Get a specific submission part for a given full submission id and its category
* *
* @param id The id of the submission part * @param id The id of the full submission
* @param category The category of the submission part
* @param responseHandler The response handler * @param responseHandler The response handler
* @param errorHandler The error handler * @param errorHandler The error handler
*/ */
function getSubmissionPart(id, responseHandler, errorHandler) { function getSubmissionPart(id, category, responseHandler, errorHandler) {
var url = "../rest/submissions/part/" + id; var url = "/full/" + id + "/category/" + category;
$.ajax({ $.ajax({
url: url, url: url,
type: "GET", type: "GET",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment