host is taken from url
This commit is contained in:
		
							
								
								
									
										1
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							| @@ -20,7 +20,6 @@ | |||||||
|   </component> |   </component> | ||||||
|   <component name="ChangeListManager"> |   <component name="ChangeListManager"> | ||||||
|     <list default="true" id="458cde88-df3d-44bc-9d57-a33823e2f1a6" name="Default Changelist" comment=""> |     <list default="true" id="458cde88-df3d-44bc-9d57-a33823e2f1a6" name="Default Changelist" comment=""> | ||||||
|       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> |  | ||||||
|       <change beforePath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" afterDir="false" /> |       <change beforePath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" afterDir="false" /> | ||||||
|     </list> |     </list> | ||||||
|     <option name="SHOW_DIALOG" value="false" /> |     <option name="SHOW_DIALOG" value="false" /> | ||||||
|   | |||||||
| @@ -3,10 +3,11 @@ var clientUUID; | |||||||
| var json; | var json; | ||||||
| var jsonIndex = 0; | var jsonIndex = 0; | ||||||
| var htable_row = 0; | var htable_row = 0; | ||||||
|  | var host = getDomain(); | ||||||
| const C_UUID = 'mock-uuid'; | const C_UUID = 'mock-uuid'; | ||||||
| function getData(){ | function getData(){ | ||||||
|     loadCookies(); |     loadCookies(); | ||||||
|     $.getJSON('http://localhost:8097/mock/json/'+clientUUID, function(data) { |     $.getJSON(host + '/mock/json/'+clientUUID, function(data) { | ||||||
|         json = data; |         json = data; | ||||||
|         clientUUID = json[jsonIndex].clientUUID; |         clientUUID = json[jsonIndex].clientUUID; | ||||||
|         setCookies(); |         setCookies(); | ||||||
| @@ -16,6 +17,13 @@ function getData(){ | |||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function getDomain(){ | ||||||
|  |     var url = window.location.href; | ||||||
|  |     var arr = url.split("/"); | ||||||
|  |     var result = arr[0] + "//" + arr[2]; | ||||||
|  |     return result; | ||||||
|  | } | ||||||
|  |  | ||||||
| function refreshData(){ | function refreshData(){ | ||||||
|     fillMessageList(); |     fillMessageList(); | ||||||
|     console.log("List initiated"); |     console.log("List initiated"); | ||||||
| @@ -50,7 +58,7 @@ function getCookie(cname) { | |||||||
| function updateData(){ | function updateData(){ | ||||||
|     var updatedJson = generateJson(); |     var updatedJson = generateJson(); | ||||||
|     var request = $.ajax({ |     var request = $.ajax({ | ||||||
|         url: 'http://localhost:8097/mock/json', |         url: host + '/mock/json', | ||||||
|         type: 'PUT', |         type: 'PUT', | ||||||
|         data: JSON.stringify(updatedJson, null, 2), |         data: JSON.stringify(updatedJson, null, 2), | ||||||
|         dataType: "json", |         dataType: "json", | ||||||
| @@ -64,7 +72,7 @@ function updateData(){ | |||||||
| function addMessage(){ | function addMessage(){ | ||||||
|  |  | ||||||
|     var request = $.ajax({ |     var request = $.ajax({ | ||||||
|         url: 'http://localhost:8097/mock/json/'+clientUUID, |         url: host + '/mock/json/'+clientUUID, | ||||||
|         type: 'POST', |         type: 'POST', | ||||||
|     }); |     }); | ||||||
|     request.done(function () { |     request.done(function () { | ||||||
| @@ -75,7 +83,7 @@ function addMessage(){ | |||||||
| function removeTile(id){ | function removeTile(id){ | ||||||
|     var jsonObject = findJsonById(id); |     var jsonObject = findJsonById(id); | ||||||
|     var request = $.ajax({ |     var request = $.ajax({ | ||||||
|         url: 'http://localhost:8097/mock/json/'+clientUUID + '/' + id, |         url: host + '/mock/json/'+clientUUID + '/' + id, | ||||||
|         type: 'DELETE', |         type: 'DELETE', | ||||||
|     }); |     }); | ||||||
|     request.done(function () { |     request.done(function () { | ||||||
| @@ -110,7 +118,7 @@ function fillStaticFields(uuid, id, mediaType, body, httpStatus){ | |||||||
| } | } | ||||||
|  |  | ||||||
| function createLink(uuid, id){ | function createLink(uuid, id){ | ||||||
|     var link = 'http://localhost:8097/klaus/v1/get/'+uuid+'/'+id; |     var link = host + '/klaus/v1/get/'+uuid+'/'+id; | ||||||
|     return link; |     return link; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user