using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace JtkMainServer.Pages {
    public class LogoutModel : PageModel {
        public IActionResult OnGet() {
            if (string.IsNullOrWhiteSpace(HttpContext.Session.GetString("LoggedInUserId")) == false) {
                HttpContext.Session.Remove("LoggedInUserId");
            }
            return RedirectToPage("./Index");
        }
        public IActionResult OnPost() {
            return OnGet();
        }
    }
}