T157 data is being saved, send and received
This commit is contained in:
@@ -8,6 +8,7 @@ var json;
|
||||
var jsonIndex = 0;
|
||||
const C_UUID = 'mock-uuid';
|
||||
function getData(){
|
||||
// sleep(5000);
|
||||
loadCookies();
|
||||
$.getJSON('http://localhost:8097/mock/json/'+clientUUID, function(data) {
|
||||
json = data;
|
||||
@@ -15,14 +16,17 @@ function getData(){
|
||||
setCookies();
|
||||
console.log(JSON.stringify(json));
|
||||
console.log("Json received");
|
||||
fillMessageList();
|
||||
console.log("List initiated");
|
||||
loadMessage(json[jsonIndex].mockedResponseId);
|
||||
console.log("Message loaded");
|
||||
|
||||
refreshData();
|
||||
});
|
||||
}
|
||||
|
||||
function refreshData(){
|
||||
fillMessageList();
|
||||
console.log("List initiated");
|
||||
loadMessage(json[jsonIndex].mockedResponseId);
|
||||
console.log("Message loaded");
|
||||
}
|
||||
|
||||
function setCookies(){
|
||||
document.cookie = C_UUID + '=' +clientUUID+';';
|
||||
}
|
||||
@@ -57,10 +61,8 @@ function updateData(){
|
||||
console.log(e);
|
||||
},
|
||||
dataType: "json",
|
||||
contentType: "application/json"
|
||||
// success: function(data) {
|
||||
// console.log('PUT request received 200');
|
||||
// }
|
||||
contentType: "application/json",
|
||||
success: getData(),
|
||||
});
|
||||
getData();
|
||||
}
|
||||
@@ -69,9 +71,7 @@ function addMessage(){
|
||||
$.ajax({
|
||||
url: 'http://localhost:8097/mock/json/'+clientUUID,
|
||||
type: 'POST',
|
||||
// success: function(data) {
|
||||
// console.log('PUT request received 200');
|
||||
// }
|
||||
success: getData(),
|
||||
});
|
||||
getData();
|
||||
}
|
||||
@@ -94,9 +94,9 @@ function initializeMock(index){
|
||||
|
||||
function fillStaticFields(uuid, id, mediaType, body, httpStatus){
|
||||
$('#messageLink').html(createLink(uuid,id));
|
||||
$('#httpStatus').html(httpStatus);
|
||||
$('#httpStatus').val(httpStatus);
|
||||
$('#typeSelector').val(mediaType);
|
||||
$('#bodyEditor').html(body);
|
||||
$('#bodyEditor').val(body);
|
||||
$('#mockedMessageId').html(id);
|
||||
|
||||
}
|
||||
@@ -211,6 +211,7 @@ function generateJson(){
|
||||
};
|
||||
newJson['httpHeaders'] = convertTableToJson();
|
||||
console.log(JSON.stringify(newJson, null, 2));
|
||||
json[jsonIndex] = newJson;
|
||||
return newJson;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user