deny method
Denies the TV: the code is spent and the TV is told no.
Acts on the code whose facts are on screen, so it does nothing while the field holds another code (canDeny).
Implementation
Future<void> deny() async {
final String? code = _lookedUp;
if (code == null || !canDeny) return;
final int epoch = _epoch;
_busy = true;
_error = null;
refreshUI();
final MagicResponse? response = await _send(
'deny',
() => Http.post(denyPath(code)),
);
if (epoch != _epoch) return;
_busy = false;
if (response != null && response.successful) {
_status = MagicStarterDeviceApproveStatus.denied;
refreshUI();
return;
}
_fail(response);
}