32 lines
765 B
C#
32 lines
765 B
C#
using Contracts.BindingModels;
|
|
using Contracts.ViewModels;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using WebApp.Helpers;
|
|
|
|
namespace WebApp.Pages.User
|
|
{
|
|
[Authorize(Roles = Roles.User)]
|
|
public class IndexModel : PageModel
|
|
{
|
|
public UserViewModel UserModel { get; set; }
|
|
|
|
public void OnGet()
|
|
{
|
|
var id = this.GetUserId();
|
|
if (id is null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
UserModel = APIClient.GetRequest<UserViewModel>($"user/get?id={id}");
|
|
}
|
|
|
|
public IActionResult OnPostSignOut()
|
|
{
|
|
this.DeleteJWT();
|
|
return RedirectToPage("../Index");
|
|
}
|
|
}
|
|
} |