@@ -32,14 +32,9 @@ public ApiClient(IKeychain keychain, IProcessManager processManager, ITaskManage
3232 {
3333 Guard . ArgumentNotNull ( keychain , nameof ( keychain ) ) ;
3434
35- if ( host == null )
36- {
37- host = UriString . ToUriString ( HostAddress . GitHubDotComHostAddress . WebUri ) ;
38- }
39- else
40- {
41- host = new UriString ( host . ToRepositoryUri ( ) . GetComponents ( UriComponents . SchemeAndServer , UriFormat . SafeUnescaped ) ) ;
42- }
35+ host = host == null
36+ ? UriString . ToUriString ( HostAddress . GitHubDotComHostAddress . WebUri )
37+ : new UriString ( host . ToRepositoryUri ( ) . GetComponents ( UriComponents . SchemeAndServer , UriFormat . SafeUnescaped ) ) ;
4338
4439 HostAddress = HostAddress . Create ( host ) ;
4540
@@ -267,7 +262,7 @@ public void LoginWithToken(string token, Action<bool> result)
267262 Guard . ArgumentNotNull ( result , "result" ) ;
268263
269264 new FuncTask < bool > ( taskManager . Token ,
270- ( ) => loginManager . LoginWithToken ( HostAddress . ApiUri . Host , token ) )
265+ ( ) => loginManager . LoginWithToken ( HostAddress . WebUri . Host , token ) )
271266 . FinallyInUI ( ( success , ex , res ) =>
272267 {
273268 if ( ! success )
@@ -284,7 +279,7 @@ public void LoginWithToken(string token, Action<bool> result)
284279
285280 public void CreateOAuthToken ( string code , Action < bool , string > result )
286281 {
287- var command = "token -h " + HostAddress . WebUri . Host ;
282+ var command = "token -h " + HostAddress . ApiUri . Host ;
288283 var octorunTask = new OctorunTask ( taskManager . Token , environment , command , code )
289284 . Configure ( processManager ) ;
290285
@@ -326,7 +321,7 @@ public void Login(string username, string password, Action<LoginResult> need2faC
326321 Guard . ArgumentNotNull ( result , "result" ) ;
327322
328323 new FuncTask < LoginResultData > ( taskManager . Token ,
329- ( ) => loginManager . Login ( HostAddress . ApiUri . Host , username , password ) )
324+ ( ) => loginManager . Login ( HostAddress . WebUri . Host , username , password ) )
330325 . FinallyInUI ( ( success , ex , res ) =>
331326 {
332327 if ( ! success )
@@ -393,7 +388,7 @@ private Connection Connection
393388 {
394389 if ( connection == null )
395390 {
396- connection = keychain . Connections . FirstOrDefault ( x => x . Host == ( UriString ) HostAddress . ApiUri . Host ) ;
391+ connection = keychain . Connections . FirstOrDefault ( x => x . Host == ( UriString ) HostAddress . WebUri . Host ) ;
397392 }
398393
399394 return connection ;
0 commit comments