Verified Commit 05a510b8 authored by Aral Balkan's avatar Aral Balkan
Browse files

Fix validation

parent 744c966f
...@@ -19,9 +19,9 @@ window.addEventListener('load', _ => { ...@@ -19,9 +19,9 @@ window.addEventListener('load', _ => {
// Interface // Interface
// //
function confirmCancellation () { async function confirmCancellation () {
// return window.confirm('Are you sure you want to cancel your patronage?') // 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?', title: 'Are you sure you want to cancel your patronage?',
text: "", text: "",
type: 'warning', type: 'warning',
...@@ -30,7 +30,7 @@ window.addEventListener('load', _ => { ...@@ -30,7 +30,7 @@ window.addEventListener('load', _ => {
cancelButtonColor: '#d33', cancelButtonColor: '#d33',
confirmButtonText: 'Yes', confirmButtonText: 'Yes',
cancelButtonText: 'No' cancelButtonText: 'No'
}) })).value
} }
function handleCommand (commandName) { function handleCommand (commandName) {
...@@ -44,12 +44,10 @@ window.addEventListener('load', _ => { ...@@ -44,12 +44,10 @@ window.addEventListener('load', _ => {
if (commandName === 'update') command.amount = $('#patronageAmount').value if (commandName === 'update') command.amount = $('#patronageAmount').value
let confirm = false let proceed = true
if (commandName === 'cancel') confirm = await confirmCancellation() if (commandName === 'cancel') proceed = await confirmCancellation()
console.log('confirm', confirm)
if (!confirm.value) return if (!proceed) return
socket.send(JSON.stringify(command)) 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