app/BTCPayApp.UI/Features/RootState.cs
Kukks 864013da9b
Refactor the connection manager + sync
# Conflicts:
#	BTCPayApp.Core/Attempt2/LightningNodeService.cs
#	submodules/btcpayserver
2024-07-30 16:11:12 +02:00

42 lines
1.4 KiB
C#

using BTCPayApp.Core.Attempt2;
using Fluxor;
using Microsoft.AspNetCore.SignalR.Client;
namespace BTCPayApp.UI.Features;
[FeatureState]
public record RootState
{
public BTCPayConnectionState ConnectionState;
public OnChainWalletState? OnchainWalletState;
public LightningNodeState? LightningNodeState;
public record ConnectionStateUpdatedAction(BTCPayConnectionState State);
public record OnChainWalletStateUpdatedAction(OnChainWalletState State);
public record LightningNodeStateUpdatedAction(LightningNodeState State);
protected class ConnectionUpdatedReducer : Reducer<RootState, ConnectionStateUpdatedAction>
{
public override RootState Reduce(RootState state, ConnectionStateUpdatedAction action)
{
return state with { ConnectionState = action.State };
}
}
protected class OnChainWalletStateUpdatedReducer : Reducer<RootState, OnChainWalletStateUpdatedAction>
{
public override RootState Reduce(RootState state, OnChainWalletStateUpdatedAction action)
{
return state with { OnchainWalletState = action.State };
}
}
protected class LightningNodeStateUpdatedReducer : Reducer<RootState, LightningNodeStateUpdatedAction>
{
public override RootState Reduce(RootState state, LightningNodeStateUpdatedAction action)
{
return state with { LightningNodeState = action.State };
}
}
}