Hardly reload
This commit is contained in:
parent
496408aa70
commit
b88d3059e9
1 changed files with 13 additions and 5 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Diagnostics;
|
using System.IO.Compression;
|
||||||
using System.IO.Compression;
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.FluentUI.AspNetCore.Components;
|
using Microsoft.FluentUI.AspNetCore.Components;
|
||||||
using Schaad.Accounting.Datasets;
|
using Schaad.Accounting.Datasets;
|
||||||
|
|
@ -35,6 +34,9 @@ public partial class Home : ComponentBase
|
||||||
[Inject]
|
[Inject]
|
||||||
private ITransactionRepository transactionRepository { get; set; } = null!;
|
private ITransactionRepository transactionRepository { get; set; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private NavigationManager Navigation { get; set; } = null!;
|
||||||
|
|
||||||
private List<Transaction>? matchingBankTransactions;
|
private List<Transaction>? matchingBankTransactions;
|
||||||
private IReadOnlyList<Account> accounts = [];
|
private IReadOnlyList<Account> accounts = [];
|
||||||
private IReadOnlyList<string> bookingTexts = [];
|
private IReadOnlyList<string> bookingTexts = [];
|
||||||
|
|
@ -138,7 +140,7 @@ public partial class Home : ComponentBase
|
||||||
}
|
}
|
||||||
else if (message.Status == MessageStatus.Warning)
|
else if (message.Status == MessageStatus.Warning)
|
||||||
{
|
{
|
||||||
ShowToast(text, ToastIntent.Warning);
|
await ShowMessageAsync(text, MessageIntent.Warning);
|
||||||
}
|
}
|
||||||
else if (message.Status == MessageStatus.Error)
|
else if (message.Status == MessageStatus.Error)
|
||||||
{
|
{
|
||||||
|
|
@ -164,7 +166,7 @@ public partial class Home : ComponentBase
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
transactionRepository.SaveTransaction(transaction);
|
transactionRepository.SaveTransaction(transaction);
|
||||||
matchingBankTransactions = viewService.MatchOpenBankTransactions();
|
ReloadPage();
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,8 +184,14 @@ public partial class Home : ComponentBase
|
||||||
var result = await dialog.Result;
|
var result = await dialog.Result;
|
||||||
if (!result.Cancelled && result.Data != null)
|
if (!result.Cancelled && result.Data != null)
|
||||||
{
|
{
|
||||||
matchingBankTransactions!.RemoveAll(q => q == transaction);
|
ReloadPage();
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ReloadPage()
|
||||||
|
{
|
||||||
|
var uri = Navigation.Uri;
|
||||||
|
Navigation.NavigateTo(uri, forceLoad: true); // forceLoad = true does a full reload
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue