Commit 05a510b8 authored by Aral Balkan's avatar Aral Balkan

Fix validation

parent 744c966f
......@@ -19,9 +19,9 @@ window.addEventListener('load', _ => {
// Interface
//
function confirmCancellation () {
async function confirmCancellation () {
// return window.confirm('Are you sure you want to cancel your patronage?')
return SweetAlert2.fire({
return (await SweetAlert2.fire({
title: 'Are you sure you want to cancel your patronage?',
text: "",
type: 'warning',
......@@ -30,7 +30,7 @@ window.addEventListener('load', _ => {
cancelButtonColor: '#d33',
confirmButtonText: 'Yes',
cancelButtonText: 'No'
})
})).value
}
function handleCommand (commandName) {
......@@ -44,12 +44,10 @@ window.addEventListener('load', _ => {
if (commandName === 'update') command.amount = $('#patronageAmount').value
let confirm = false
if (commandName === 'cancel') confirm = await confirmCancellation()
console.log('confirm', confirm)
let proceed = true
if (commandName === 'cancel') proceed = await confirmCancellation()
if (!confirm.value) return
if (!proceed) return
socket.send(JSON.stringify(command))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment