diff --git a/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs b/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs index 0e6869a..51bab38 100644 --- a/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs +++ b/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs @@ -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(() => diff --git a/LANCommander.SDK/Client.cs b/LANCommander.SDK/Client.cs index 68c09c0..ae3be25 100644 --- a/LANCommander.SDK/Client.cs +++ b/LANCommander.SDK/Client.cs @@ -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 GetGames() { return GetRequest>("/api/Games");