Skip to content

Commit e7996bd

Browse files
committed
Don't allow multi-save
1 parent 06c5c97 commit e7996bd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewBlogPost.razor

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
otherwise its original date</small>
6363
</div>
6464
}
65-
<button class="btn btn-primary" type="submit">Submit</button>
65+
<button class="btn btn-primary" type="submit" disabled="@canSubmit">Submit</button>
6666
</EditForm>
6767
</div>
6868
<div class="preview">
@@ -99,6 +99,8 @@
9999

100100
private CreateNewModel model = new();
101101

102+
private bool canSubmit = true;
103+
102104
protected override void OnParametersSet()
103105
{
104106
if (BlogPost == null)
@@ -120,8 +122,10 @@
120122

121123
private async Task OnValidBlogPostCreatedAsync()
122124
{
125+
canSubmit = false;
123126
await OnBlogPostCreated.InvokeAsync(model.ToBlogPost());
124127
ClearModel();
128+
canSubmit = true;
125129
}
126130

127131
private void ClearModel()

0 commit comments

Comments
 (0)