BlazorStart/Start/Client/Store/Features/DeleteContainer/DeleteContainerReducers.cs

51 lines
1.6 KiB
C#
Raw Permalink Normal View History

2021-12-04 00:44:02 +00:00
using Fluxor;
namespace Start.Client.Store.Features.DeleteContainer {
public static class DeleteContainerReducers {
[ReducerMethod]
public static DeleteContainerState ShowDeleteContainerForm(DeleteContainerState state,
ShowDeleteContainerFormAction action) {
return state with {
ShowDeleteContainerForm = true,
BookmarkContainerIdToDelete = action.ContainerIdToDelete,
BookmarkContainerTitleToDelete = action.ContainerTitleToDelete,
DeleteContainerErrorMessage = null
};
}
[ReducerMethod(typeof(HideDeleteContainerFormAction))]
public static DeleteContainerState HideDeleteContainerForm(DeleteContainerState state) {
return state with {
ShowDeleteContainerForm = false,
DeleteContainerErrorMessage = null
};
}
[ReducerMethod(typeof(FetchDeleteContainerFormAction))]
public static DeleteContainerState FetchDeleteContainerForm(DeleteContainerState state) {
return state with {
IsLoadingDeleteContainer = true,
DeleteContainerErrorMessage = null
};
}
[ReducerMethod(typeof(RecievedDeleteContainerAction))]
public static DeleteContainerState ReceivedDeleteContainer(DeleteContainerState state) {
return state with {
IsLoadingDeleteContainer = false,
DeleteContainerErrorMessage = null,
ShowDeleteContainerForm = false
};
}
[ReducerMethod]
public static DeleteContainerState ErrorFetchingDeleteContainer(DeleteContainerState state,
ErrorFetchingDeleteContainerAction action) {
return state with {
DeleteContainerErrorMessage = action.ErrorMessage,
IsLoadingDeleteContainer = false
};
}
}
}