Skip to content

Commit 54e6935

Browse files
author
Hugues Signamarcheix
committed
back api now plugged
1 parent 4099544 commit 54e6935

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

front/javascript/dist/worker-bundled.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ const apiMaxId = 54;
66
onmessage = (e) => {
77
console.log('here')
88
let id = (Math.floor(Math.random() * Math.floor(apiMaxId))) + 1
9-
postMessage('a')
10-
//axios.get('http://js-worker.local/' + id)
11-
// .then(response => (postMessage(response.data)))
9+
axios.get('http://js-worker.local/' + id)
10+
.then(response => (postMessage(response.data)))
1211
}
1312
},{"axios":2}],2:[function(require,module,exports){
1413
module.exports = require('./lib/axios');

front/javascript/script.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,9 @@ document.addEventListener("DOMContentLoaded",() => {
1414
});
1515

1616
worker.onmessage = function(e) {
17-
let jsonTest = {
18-
'id': '50',
19-
'name': 'Kamren Carter',
20-
'age': '74',
21-
'city': '525 Hand Loop',
22-
'bio': 'Eos voluptatibus neque et qui aperiam. Fuga et nostrum expedita commodi maxime porro.'
23-
}
24-
//let textContent = e.data;
25-
//textPlaceholder.innerHTML = textContent;
17+
let jsonFetched = e.data;
2618
for(let fieldName of fields) {
27-
document.getElementsByClassName(fieldName)[0].innerHTML = jsonTest[fieldName];
19+
document.getElementsByClassName(fieldName)[0].innerHTML = jsonFetched[fieldName];
2820
}
2921
container.classList.remove('is-loading');
3022
}

front/javascript/worker.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const apiMaxId = 54;
55
onmessage = (e) => {
66
console.log('here')
77
let id = (Math.floor(Math.random() * Math.floor(apiMaxId))) + 1
8-
postMessage('a')
9-
//axios.get('http://js-worker.local/' + id)
10-
// .then(response => (postMessage(response.data)))
8+
axios.get('http://js-worker.local/' + id)
9+
.then(response => (postMessage(response.data)))
1110
}

front/scss/pages/index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ h1 {
3131
}
3232
.loader {
3333
position: absolute;
34-
top: 50%;
34+
top: 65%;
3535
left: 50%;
3636
transform: translate(-50%,-50%);
3737
}

front/style.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)