Update unlock page
This commit is contained in:
+11
-12
@@ -41,20 +41,19 @@
|
||||
</main>
|
||||
<script src="/web.js"></script>
|
||||
<script>
|
||||
function submitForm (formElement) {
|
||||
async function submitForm (formElement) {
|
||||
const formData = new FormData(formElement)
|
||||
|
||||
fetch('/unlock', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(Object.fromEntries(formData.entries()))
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
document.documentElement.innerHTML = html
|
||||
initLightGallery() // from web.js
|
||||
try {
|
||||
const res = await fetch('/unlock', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(Object.fromEntries(formData.entries()))
|
||||
})
|
||||
.catch(error => console.error('Error:', error))
|
||||
if (res.status === 200) {
|
||||
document.documentElement.innerHTML = await res.text()
|
||||
initLightGallery() // from web.js
|
||||
}
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
document.getElementById('unlock')
|
||||
|
||||
Reference in New Issue
Block a user