fix prism destination submit

This commit is contained in:
Kukks
2023-07-27 14:33:50 +02:00
parent 7771a321cb
commit d6d07d33f4
3 changed files with 11 additions and 22 deletions

View File

@@ -11,7 +11,7 @@
<PropertyGroup> <PropertyGroup>
<Product>LN Prism</Product> <Product>LN Prism</Product>
<Description>Automated value splits for lightning.</Description> <Description>Automated value splits for lightning.</Description>
<Version>1.1.6</Version> <Version>1.1.7</Version>
</PropertyGroup> </PropertyGroup>
<!-- Plugin development properties --> <!-- Plugin development properties -->
<PropertyGroup> <PropertyGroup>

View File

@@ -5,7 +5,7 @@
<input type="text" @bind="WorkingId" class="form-control"/> <input type="text" @bind="WorkingId" class="form-control"/>
@if (InvalidId) @if (InvalidId)
{ {
<span class="text-danger">Invalid</span> <span class="text-danger w-100">Invalid</span>
} }
<span class="form-text">An alias to reference in destinations of prisms.</span> <span class="form-text">An alias to reference in destinations of prisms.</span>
</div> </div>
@@ -14,7 +14,7 @@
<input type="text" @bind="WorkingCopy.Destination" class="form-control"/> <input type="text" @bind="WorkingCopy.Destination" class="form-control"/>
@if (Invalid) @if (Invalid)
{ {
<span class="text-danger">Invalid</span> <span class="text-danger w-100">Invalid</span>
} }
<span class="form-text">Can be a lightning address, LNURL, or a custom value that another plugin supports</span> <span class="form-text">Can be a lightning address, LNURL, or a custom value that another plugin supports</span>
</div> </div>
@@ -79,27 +79,16 @@
public async Task Update() public async Task Update()
{ {
if (ValidateDestination.Invoke(WorkingCopy.Destination)) Invalid = !ValidateDestination.Invoke(WorkingCopy.Destination);
{
await SettingsChanged.InvokeAsync(WorkingCopy);
Invalid = false; InvalidId = !ValidateId.Invoke(WorkingId);
}
else
{
Invalid = true;
}
if (ValidateId.Invoke(WorkingId)) if(Invalid || InvalidId)
{ {
await IdChanged.InvokeAsync(WorkingId); return;
InvalidId = false;
}
else
{
InvalidId = true;
} }
await SettingsChanged.InvokeAsync(WorkingCopy);
await IdChanged.InvokeAsync(WorkingId);
} }
[Parameter] [Parameter]

View File

@@ -157,7 +157,7 @@ else
{ {
get get
{ {
if (SelectedDestinationId is null || SelectedDestinationId == "null") if (SelectedDestinationId is null or "null")
return null; return null;
Settings.Destinations.TryGetValue(SelectedDestinationId, out var res); Settings.Destinations.TryGetValue(SelectedDestinationId, out var res);
return res; return res;