Ignore:
Timestamp:
05/12/22 16:36:14 (2 years ago)
Author:
Danilo <danilo.najkov@…>
Branches:
master
Children:
cc4db18
Parents:
7a983b0
Message:

prototype final

File:
1 edited

Legend:

Unmodified
Added
Removed
  • resTools_backend/backend/Controllers/UsersController.cs

    r7a983b0 rd76b7ee  
    22
    33using backend.DTOs;
     4using backend.Entities;
    45using backend.Helpers;
    56using backend.Models;
     
    2930    }
    3031
     32    [HttpGet("authed")]
     33    public async Task<AuthenticateResponse> IsAuthed()
     34    {
     35        int userId = 0;
     36        try
     37        {
     38            userId = (int)this.HttpContext.Items["User"];
     39        }catch (Exception ex){ return null; }
     40        User user = await _userService.GetById(userId);
     41        return new AuthenticateResponse() { Email=user.Email, Id = user.Id};
     42    }
     43
    3144    [HttpPost("register")]
    3245    public async Task<AuthenticateResponse> Register(CreateUserRequest req)
Note: See TracChangeset for help on using the changeset viewer.