2018-05-26 14:33:15 +02:00
|
|
|
window.addEventListener('load', async () => {
|
|
|
|
console.log("Seite geladen");
|
2018-06-17 23:05:13 +02:00
|
|
|
|
2018-06-11 17:44:54 +02:00
|
|
|
//getNewUniqueLink();
|
|
|
|
document.getElementById('btnCreateTan').addEventListener('click' , async (event) => getNewUniqueLink());
|
2018-05-26 14:33:15 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
async function getNewUniqueLink() {
|
2018-06-17 23:05:13 +02:00
|
|
|
const phpSessionForm = new FormData();
|
|
|
|
phpSessionForm.append("phpSession", PHPSESSIONUSER);
|
2018-05-26 14:33:15 +02:00
|
|
|
try {
|
2018-06-17 23:05:13 +02:00
|
|
|
var firstFetch = await fetch('php/generateLink.php', {
|
|
|
|
method: 'post',
|
|
|
|
body: phpSessionForm
|
|
|
|
});
|
2018-05-26 14:33:15 +02:00
|
|
|
var jsonFirstFetch = await firstFetch.json();
|
|
|
|
var content = document.getElementById('content');
|
|
|
|
content.innerHTML = `${jsonFirstFetch.html}`;
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
console.log("Server nicht erreichbar.");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2018-06-11 18:15:21 +02:00
|
|
|
|
|
|
|
//<!--Register-->
|
|
|
|
document.getElementById('btnCreate').addEventListener("click" , async (event) => {
|
2018-06-17 23:24:47 +02:00
|
|
|
event.preventDefault();
|
2018-06-11 18:15:21 +02:00
|
|
|
const formData = new FormData(document.getElementById('create-form'));
|
|
|
|
try {
|
2018-06-17 18:24:56 +02:00
|
|
|
const response = await fetch('php/signup.php', {
|
2018-06-11 18:15:21 +02:00
|
|
|
method: 'post',
|
|
|
|
body: formData
|
|
|
|
});
|
2018-06-13 19:46:32 +02:00
|
|
|
const jsonData = await response.json();
|
|
|
|
console.log(jsonData);
|
|
|
|
|
2018-06-11 18:15:21 +02:00
|
|
|
} catch (e) {
|
|
|
|
console.log("Abschicken der Daten fehlerhaft!");
|
|
|
|
}
|
|
|
|
})
|
2018-06-17 23:05:13 +02:00
|
|
|
|
|
|
|
function getCookieValue(a) {
|
|
|
|
var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)');
|
|
|
|
return b ? b.pop() : '';
|
|
|
|
}
|