Struggling to get the onConfirm notification to work without throwing a JS error