1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-11-24 04:42:56 +01:00
Minecraft-Phantom-Panel/Server/Phantom.Server.Web.Components/Utils/EditContextExtensions.cs

14 lines
439 B
C#

using Microsoft.AspNetCore.Components.Forms;
namespace Phantom.Server.Web.Components.Utils;
public static class EditContextExtensions {
public static void RevalidateWhenFieldChanges(this EditContext editContext, string tracked, string revalidated) {
editContext.OnFieldChanged += (_, args) => {
if (args.FieldIdentifier.FieldName == tracked) {
editContext.NotifyFieldChanged(editContext.Field(revalidated));
}
};
}
}