Skip to content
Snippets Groups Projects
Commit bc90226c authored by Sami Spets's avatar Sami Spets
Browse files

Minor changes into POST /stream/config route

parent 12e16196
No related branches found
No related tags found
No related merge requests found
......@@ -207,14 +207,8 @@ app.get('/stream/depth', (req, res) => {
});
app.post('/stream/config', async (req, res) => {
const {board_size, square_size, frame_delay, num_frames, URI} = req.body;
const {URI, data} = req.body;
console.log(req.body)
const data = {
board_size,
square_size,
frame_delay,
num_frames
}
const savedConfigs = new Configs({
URI,
data
......
......@@ -191,39 +191,37 @@ const cardLogic = () => {
configs = () => {
const container = document.getElementById("container");
container.innerHTML = `<div class="ftlab-configurations"></div>`;
let configContainer = document.getElementsByClassName("ftlab-configurations")[0];
// let configContainer = document.getElementsByClassName("ftlab-configurations")[0];
renderConfigOptions();
}
renderConfigOptions = () => {
const input = `<p>input1</p><br><input type="text">`
const input = `<p>input1</p><br>ftl://utu.fi#<input type="text">`
const doc = document.getElementsByClassName('ftlab-configurations')[0];
doc.innerHTML = input
doc.innerHTML = input;
}
updateConfigs = async () => {
current_data.configURI = "ftl://utu.fi#reconstruction_snap10/merge"
loadConfigs = async () => {
const configURI = encodeURIComponent(current_data.configURI);
const uri = encodeURIComponent(current_data.uri)
const rawResp = await fetch(`http://localhost:8080/stream/config?settings=${configURI}&uri=${uri}`)
const response = await rawResp.json();
const content = JSON.parse(response);
container.innerHTML += `<p>${response}</p>`;
console.log(content)
}
saveConfigs = async () => {
const rawResp = await fetch('http://localhost:8080/stream/config', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({board_size: [0, 5], square_size: 1, frame_delay: 5, num_frames: 10, URI: "current_data.uri"})
body: {uri: current_data.configURI, data: current_data.configData}
});
const content = await rawResp.json();
console.log(content)
}
//current_data.configURI
//configURI =
/**
* current_data.configURI is a dropdown menu
*/
current_data.configs = "ftl://utu.fi#reconstruction_snap10/merge/maxerror"
loadConfigs = async () => {
const configURI = encodeURIComponent(current_data.configs);
const uri = encodeURIComponent(current_data.uri)
const rawResp = await fetch(`http://localhost:8080/stream/config?settings=${configURI}&uri=${uri}`)
const content = await rawResp.json();
console.log(content)
}
\ No newline at end of file
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