progress commit
This commit is contained in:
parent
184ba3a096
commit
9fa145866a
2 changed files with 22 additions and 3 deletions
|
@ -36,12 +36,15 @@
|
||||||
<RadzenTextArea Placeholder="Content..." @bind-Value="@postContent" Cols="30" Rows="6" Class="w-100"/>
|
<RadzenTextArea Placeholder="Content..." @bind-Value="@postContent" Cols="30" Rows="6" Class="w-100"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pd centered marg">
|
<div class="pd centered marg">
|
||||||
<FormInfo/>
|
<FormInfo/>
|
||||||
<InputFile OnChange="@SingleUpload" type="file" accept="image/*"/>
|
<InputFile OnChange="@SingleUpload" type="file" accept="image/*"/>
|
||||||
|
@if (hasErr)
|
||||||
|
{
|
||||||
|
<span class="postError">@postErr</span>
|
||||||
|
}
|
||||||
<RadzenButton class="pd" Click="@onPostClick" Text="Post!"></RadzenButton>
|
<RadzenButton class="pd" Click="@onPostClick" Text="Post!"></RadzenButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -79,6 +82,9 @@
|
||||||
this.StateHasChanged();
|
this.StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string postErr { get; set; }
|
||||||
|
bool hasErr { get; set; } = false;
|
||||||
|
|
||||||
private async Task onPostClick()
|
private async Task onPostClick()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -86,9 +92,18 @@
|
||||||
var user = await cauthStateProvder.GetAuthenticationStateAsync();
|
var user = await cauthStateProvder.GetAuthenticationStateAsync();
|
||||||
var usr = user.User;
|
var usr = user.User;
|
||||||
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
|
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
|
||||||
int userID = foundusr.UserID;
|
if (foundusr == null)
|
||||||
if(foundusr.TimeBanned != -1)
|
{
|
||||||
|
hasErr = true;
|
||||||
|
postErr = "You are not logged in.";
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
int userID = foundusr.UserID;
|
||||||
|
if (foundusr.TimeBanned != -1)
|
||||||
|
{
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
foundusr.lastActionTimeStamp = DateTimeOffset.UnixEpoch.ToUnixTimeMilliseconds();
|
foundusr.lastActionTimeStamp = DateTimeOffset.UnixEpoch.ToUnixTimeMilliseconds();
|
||||||
await UsersRepository.updateUserAsync(foundusr);
|
await UsersRepository.updateUserAsync(foundusr);
|
||||||
|
|
||||||
|
|
|
@ -38,3 +38,7 @@
|
||||||
text-align: left;
|
text-align: left;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.postError{
|
||||||
|
color: #ff191c;
|
||||||
|
}
|
Loading…
Reference in a new issue