Files
myDrive/webUI/src/index.js
T
2020-05-15 14:29:43 -04:00

28 lines
655 B
JavaScript

console.log("Hello, there", process.env.PORT);
import axios from "axios";
const formElement = document.getElementById("form-submit")
const inputElement = document.getElementById("input-password");
const mainDiv = document.getElementById("main-div")
formElement.addEventListener("submit", async (e) => {
e.preventDefault();
const fullURL = process.env.SERVER_IP;
const value = inputElement.value;
const data = {password: value}
axios.post(fullURL + "/submit", data).then(() => {
inputElement.value = "";
mainDiv.style.display = "none";
}).catch((err) => {
console.log("Error", err);
});
})