mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Re-added feedback to login page
This commit is contained in:
parent
c1cb45e6cd
commit
6179ad7f95
1 changed files with 52 additions and 1 deletions
|
@ -92,19 +92,70 @@
|
||||||
<div id='text' class='text'>
|
<div id='text' class='text'>
|
||||||
Új jelszót a meglévő felhasználóktól lehet kérni
|
Új jelszót a meglévő felhasználóktól lehet kérni
|
||||||
</div>
|
</div>
|
||||||
|
<div id='feedback'>
|
||||||
|
<textarea placeholder='Feedback' id='feedbackTextArea'></textarea>
|
||||||
|
<div class='ircLinkContainer' >
|
||||||
|
<a class='ircLink' href='<%= devel? 'http' : 'https' %>://qmining.frylabs.net/irc?loginClick'>IRC</a>
|
||||||
|
</div>
|
||||||
|
<button id='sendFeedbackButton' onclick="SendFeedback(this)">Submit</button>
|
||||||
|
</div>
|
||||||
<div id='form'>
|
<div id='form'>
|
||||||
<div class='inputContainer'>
|
<div class='inputContainer'>
|
||||||
<input type='text' id='pw' name='pw' autocomplete="off"/>
|
<input type='text' id='pw' name='pw' autocomplete="off"/>
|
||||||
<input type='hidden' id='cid' name='pw' autocomplete="off"/>
|
<input type='hidden' id='cid' name='pw' autocomplete="off"/>
|
||||||
</div>
|
</div>
|
||||||
<div class='ircLinkContainer' >
|
<div class='ircLinkContainer' >
|
||||||
<a class='ircLink' href='<%= devel? 'http' : 'https' %>://qmining.frylabs.net/irc?loginClick'>IRC</a>
|
<a class='ircLink' onclick='ShowFeedback()'>Contact</a>
|
||||||
</div>
|
</div>
|
||||||
<button id='sendButton' onclick="Login(this)">Login</button>
|
<button id='sendButton' onclick="Login(this)">Login</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
function HandleFeedbackResp (resp) {
|
||||||
|
document.getElementById('sendButton').innerText = 'Submit'
|
||||||
|
const textNode = document.getElementById('text')
|
||||||
|
const feedback = document.getElementById('feedback').style.display = "none";
|
||||||
|
if (resp.success) {
|
||||||
|
textNode.innerText = 'Visszajelzés elküldve'
|
||||||
|
} else {
|
||||||
|
textNode.innerText = 'Szerver oldali hiba :c'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function SendFeedback (button) {
|
||||||
|
const feedback = document.getElementById('feedbackTextArea').value
|
||||||
|
button.innerText = '...'
|
||||||
|
const rawResponse = await fetch('<%= devel? 'http' : 'https' %>://api.frylabs.net/postfeedback', {
|
||||||
|
method: 'POST',
|
||||||
|
credentials: 'include',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
description: feedback,
|
||||||
|
fromLogin: true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if (!rawResponse.ok) {
|
||||||
|
document.getElementById('text').innerText = 'Internal server error'
|
||||||
|
button.innerText = 'Submit'
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
rawResponse.json()
|
||||||
|
.then((resp) => {
|
||||||
|
HandleFeedbackResp(resp)
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
document.getElementById('text').innerText = 'Invalid data recieved from server'
|
||||||
|
button.innerText = 'Submit'
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function ShowFeedback () {
|
||||||
|
const form = document.getElementById('form').style.display = "none";
|
||||||
|
const feedback = document.getElementById('feedback').style.display = "block";
|
||||||
|
}
|
||||||
function HandleResp (resp) {
|
function HandleResp (resp) {
|
||||||
document.getElementById('sendButton').innerText = 'Login'
|
document.getElementById('sendButton').innerText = 'Login'
|
||||||
const textNode = document.getElementById('text')
|
const textNode = document.getElementById('text')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue