progress commit

This commit is contained in:
limited_dev 2023-02-02 22:13:03 +01:00
parent 184ba3a096
commit 9fa145866a
2 changed files with 22 additions and 3 deletions

View file

@ -36,12 +36,15 @@
<RadzenTextArea Placeholder="Content..." @bind-Value="@postContent" Cols="30" Rows="6" Class="w-100"/>
</div>
</div>
</div>
<div class="pd centered marg">
<FormInfo/>
<InputFile OnChange="@SingleUpload" type="file" accept="image/*"/>
@if (hasErr)
{
<span class="postError">@postErr</span>
}
<RadzenButton class="pd" Click="@onPostClick" Text="Post!"></RadzenButton>
</div>
@ -79,6 +82,9 @@
this.StateHasChanged();
}
string postErr { get; set; }
bool hasErr { get; set; } = false;
private async Task onPostClick()
{
@ -86,9 +92,18 @@
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
if (foundusr == null)
{
hasErr = true;
postErr = "You are not logged in.";
return;
}
int userID = foundusr.UserID;
if (foundusr.TimeBanned != -1)
{
return;
}
foundusr.lastActionTimeStamp = DateTimeOffset.UnixEpoch.ToUnixTimeMilliseconds();
await UsersRepository.updateUserAsync(foundusr);

View file

@ -38,3 +38,7 @@
text-align: left;
display: flex;
}
.postError{
color: #ff191c;
}