예제 #1
0
        public async Task <IActionResult> GetCheckLogin()
        {
            try
            {
                var login = await repo.GetUserByToken(User);

                if (login == null)
                {
                    return(StatusCode(StatusCodes.Status200OK, null));
                }
                var token = await repo.GetJWTToken(login.UserName);

                return(StatusCode(StatusCodes.Status200OK, new LoginViewModel()
                {
                    Token = token, User = login
                }));
            }
            catch (System.Exception ex)
            {
                return(StatusCode(StatusCodes.Status400BadRequest, ex.Message));
            }
        }