Allow updating of SDK client's server address. Fix Playnite plugin logins when no extension data exists on first start up.
parent
6a3c55f669
commit
2a80964fe1
|
@ -102,6 +102,8 @@ namespace LANCommander.PlaynitePlugin.Views
|
|||
|
||||
if (Plugin.LANCommanderClient == null)
|
||||
Plugin.LANCommanderClient = new LANCommander.SDK.Client(Context.ServerAddress);
|
||||
else
|
||||
Plugin.LANCommanderClient.UseServerAddress(Context.ServerAddress);
|
||||
|
||||
var response = await Plugin.LANCommanderClient.AuthenticateAsync(Context.UserName, Context.Password);
|
||||
|
||||
|
@ -122,6 +124,8 @@ namespace LANCommander.PlaynitePlugin.Views
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, ex.Message);
|
||||
|
||||
Plugin.PlayniteApi.Dialogs.ShowErrorMessage(ex.Message);
|
||||
|
||||
LoginButton.Dispatcher.Invoke(new System.Action(() =>
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace LANCommander.SDK
|
|||
{
|
||||
private readonly ILogger Logger;
|
||||
|
||||
private readonly RestClient ApiClient;
|
||||
private RestClient ApiClient;
|
||||
private AuthToken Token;
|
||||
|
||||
public string BaseUrl;
|
||||
|
@ -231,6 +231,12 @@ namespace LANCommander.SDK
|
|||
Token = token;
|
||||
}
|
||||
|
||||
public void UseServerAddress(string address)
|
||||
{
|
||||
BaseUrl = address;
|
||||
ApiClient = new RestClient(BaseUrl);
|
||||
}
|
||||
|
||||
public IEnumerable<Game> GetGames()
|
||||
{
|
||||
return GetRequest<IEnumerable<Game>>("/api/Games");
|
||||
|
|
Loading…
Reference in New Issue