Рефакторинг
This commit is contained in:
parent
b77b39e859
commit
a9e7a9fc6b
@ -9,7 +9,10 @@ buttonPlus.onclick = function(event) {
|
||||
let num_2 = numberTwoInput.value;
|
||||
fetch(`http://localhost:8080/sum?first=${num_1}&second=${num_2}`)
|
||||
.then(response => response.text())
|
||||
.then(res => resultInput.value = res);
|
||||
.then(res => {
|
||||
const ru = new Intl.NumberFormat("ru").format(res);
|
||||
resultInput.value = ru;
|
||||
});
|
||||
}
|
||||
buttonMinus.onclick = function(event) {
|
||||
event.preventDefault();
|
||||
@ -17,15 +20,22 @@ buttonMinus.onclick = function(event) {
|
||||
let num_2 = numberTwoInput.value;
|
||||
fetch(`http://localhost:8080/minus?first=${num_1}&second=${num_2}`)
|
||||
.then(response => response.text())
|
||||
.then(res => resultInput.value = res);
|
||||
.then(res => {
|
||||
const ru = new Intl.NumberFormat("ru").format(res);
|
||||
resultInput.value = ru;
|
||||
});
|
||||
}
|
||||
buttonMulti.onclick = function(event) {
|
||||
event.preventDefault();
|
||||
let num_1 = numberOneInput.value;
|
||||
let num_2 = numberTwoInput.value;
|
||||
|
||||
fetch(`http://localhost:8080/multi?first=${num_1}&second=${num_2}`)
|
||||
.then(response => response.text())
|
||||
.then(res => resultInput.value = res);
|
||||
.then(res => {
|
||||
const ru = new Intl.NumberFormat("ru").format(res);
|
||||
resultInput.value = ru;
|
||||
});
|
||||
}
|
||||
buttonDiv.onclick = function(event) {
|
||||
event.preventDefault();
|
||||
@ -33,5 +43,9 @@ buttonDiv.onclick = function(event) {
|
||||
let num_2 = numberTwoInput.value;
|
||||
fetch(`http://localhost:8080/div?first=${num_1}&second=${num_2}`)
|
||||
.then(response => response.text())
|
||||
.then(res => resultInput.value = res);
|
||||
}
|
||||
.then(res =>
|
||||
{
|
||||
const ru = new Intl.NumberFormat("ru").format(res);
|
||||
resultInput.value = ru;
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user