Fix Log Off Bug
fixes the bug where header was not being cleared on log off
This commit is contained in:
parent
2ed8e331ec
commit
5c2b914884
@ -62,6 +62,11 @@ namespace RMWPFInterfaceLibrary.Api
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LogOffUser()
|
||||||
|
{
|
||||||
|
_apiClient.DefaultRequestHeaders.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task GetLogedInUserInfo(string token)
|
public async Task GetLogedInUserInfo(string token)
|
||||||
{
|
{
|
||||||
_apiClient.DefaultRequestHeaders.Clear();
|
_apiClient.DefaultRequestHeaders.Clear();
|
||||||
|
@ -7,6 +7,7 @@ namespace RMWPFInterfaceLibrary.Api
|
|||||||
public interface IAPIHelper
|
public interface IAPIHelper
|
||||||
{
|
{
|
||||||
HttpClient ApiClient { get; }
|
HttpClient ApiClient { get; }
|
||||||
|
void LogOffUser();
|
||||||
Task<AuthenticatedUser> Authenticate(string username, string password);
|
Task<AuthenticatedUser> Authenticate(string username, string password);
|
||||||
Task GetLogedInUserInfo(string token);
|
Task GetLogedInUserInfo(string token);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,6 @@ namespace RMWPFInterfaceLibrary.Models
|
|||||||
string Id { get; set; }
|
string Id { get; set; }
|
||||||
string LastName { get; set; }
|
string LastName { get; set; }
|
||||||
string Token { get; set; }
|
string Token { get; set; }
|
||||||
void LogOffUser();
|
void ResetUserModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace RMWPFInterfaceLibrary.Models
|
|||||||
public string EmailAddress { get; set; }
|
public string EmailAddress { get; set; }
|
||||||
public DateTime CreatedDate { get; set; }
|
public DateTime CreatedDate { get; set; }
|
||||||
|
|
||||||
public void LogOffUser()
|
public void ResetUserModel()
|
||||||
{
|
{
|
||||||
Token = "";
|
Token = "";
|
||||||
Id = "";
|
Id = "";
|
||||||
|
@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
using RMWPFInterfaceLibrary.Api;
|
||||||
using RMWPFInterfaceLibrary.Models;
|
using RMWPFInterfaceLibrary.Models;
|
||||||
using RMWPFUserInterface.EventModels;
|
using RMWPFUserInterface.EventModels;
|
||||||
|
|
||||||
@ -15,12 +16,15 @@ namespace RMWPFUserInterface.ViewModels
|
|||||||
private IEventAggregator _events;
|
private IEventAggregator _events;
|
||||||
private SalesViewModel _salesVM;
|
private SalesViewModel _salesVM;
|
||||||
private ILoggedInUserModel _user;
|
private ILoggedInUserModel _user;
|
||||||
|
private IAPIHelper _apiHelper;
|
||||||
public ShellViewModel(IEventAggregator events, SalesViewModel salesVM,
|
public ShellViewModel(IEventAggregator events, SalesViewModel salesVM,
|
||||||
SimpleContainer container, ILoggedInUserModel user)
|
SimpleContainer container, ILoggedInUserModel user, IAPIHelper apiHelper)
|
||||||
{
|
{
|
||||||
_salesVM = salesVM;
|
_salesVM = salesVM;
|
||||||
_events = events;
|
_events = events;
|
||||||
_user = user;
|
_user = user;
|
||||||
|
_apiHelper = apiHelper;
|
||||||
|
|
||||||
|
|
||||||
_events.SubscribeOnUIThread(this);
|
_events.SubscribeOnUIThread(this);
|
||||||
|
|
||||||
@ -48,7 +52,8 @@ namespace RMWPFUserInterface.ViewModels
|
|||||||
|
|
||||||
public void LogOut()
|
public void LogOut()
|
||||||
{
|
{
|
||||||
_user.LogOffUser();
|
_user.ResetUserModel();
|
||||||
|
_apiHelper.LogOffUser();
|
||||||
|
|
||||||
NotifyOfPropertyChange(() => IsLoggedIn);
|
NotifyOfPropertyChange(() => IsLoggedIn);
|
||||||
ActivateItemAsync(IoC.Get<LoginViewModel>());
|
ActivateItemAsync(IoC.Get<LoginViewModel>());
|
||||||
|
Loading…
Reference in New Issue
Block a user