Skip to content

Commit 19b4722

Browse files
Fix credential delete (actionresult)
1 parent 3f522bf commit 19b4722

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/Certify.Client/CertifyApiClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,10 +695,10 @@ public async Task<StoredCredential> UpdateCredentials(StoredCredential credentia
695695
return JsonConvert.DeserializeObject<StoredCredential>(await result.Content.ReadAsStringAsync());
696696
}
697697

698-
public async Task<bool> DeleteCredential(string credentialKey, AuthContext authContext = null)
698+
public async Task<ActionResult> DeleteCredential(string credentialKey, AuthContext authContext = null)
699699
{
700700
var result = await DeleteAsync($"credentials/{credentialKey}", authContext);
701-
return JsonConvert.DeserializeObject<bool>(await result.Content.ReadAsStringAsync());
701+
return JsonConvert.DeserializeObject<ActionResult>(await result.Content.ReadAsStringAsync());
702702
}
703703

704704
public async Task<ActionResult> TestCredentials(string credentialKey, AuthContext authContext = null)

src/Certify.Client/ICertifyClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public partial interface ICertifyInternalApiClient
5252
#region Credentials
5353
Task<List<StoredCredential>> GetCredentials(AuthContext authContext = null);
5454
Task<StoredCredential> UpdateCredentials(StoredCredential credential, AuthContext authContext = null);
55-
Task<bool> DeleteCredential(string credentialKey, AuthContext authContext = null);
55+
Task<ActionResult> DeleteCredential(string credentialKey, AuthContext authContext = null);
5656
Task<ActionResult> TestCredentials(string credentialKey, AuthContext authContext = null);
5757
#endregion Credentials
5858

src/Certify.Server/Certify.Server.HubService/Services/CertifyDirectHubService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private ServiceControllers.SystemController _systemController(AuthContext authCo
109109

110110
public Task<List<ActionStep>> CopyDataStore(string sourceId, string targetId, AuthContext? authContext = null) => throw new NotImplementedException();
111111
public Task<ActionResult> DeleteCertificateAuthority(string id, AuthContext? authContext = null) => throw new NotImplementedException();
112-
public Task<bool> DeleteCredential(string credentialKey, AuthContext? authContext = null) => throw new NotImplementedException();
112+
public Task<ActionResult> DeleteCredential(string credentialKey, AuthContext? authContext = null) => throw new NotImplementedException();
113113
public Task<bool> DeleteManagedCertificate(string managedItemId, AuthContext? authContext = null) => throw new NotImplementedException();
114114

115115
public Task<List<AccountDetails>> GetAccounts(AuthContext? authContext = null) => throw new NotImplementedException();

src/Certify.UI.Shared/Controls/Settings/Credentials.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ private async void DeleteStoredCredential_Click(object sender, RoutedEventArgs e
8585
{
8686
//confirm item not used then delete
8787
var deleted = await EditModel.MainViewModel.DeleteCredential(EditModel.SelectedStoredCredential?.StorageKey);
88-
if (!deleted)
88+
if (!deleted.IsSuccess)
8989
{
90-
MessageBox.Show("This stored credential could not be removed. It may still be in use by a managed site.");
90+
MessageBox.Show("This stored credential could not be removed. It may still be in use by a managed item.");
9191
}
9292
}
9393

src/Certify.UI.Shared/ViewModel/AppViewModel/AppViewModel.Config.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ public async Task<StoredCredential> UpdateCredential(StoredCredential credential
200200
/// </summary>
201201
/// <param name="credentialKey"></param>
202202
/// <returns></returns>
203-
public async Task<bool> DeleteCredential(string credentialKey)
203+
public async Task<ActionResult> DeleteCredential(string credentialKey)
204204
{
205205
if (credentialKey == null)
206206
{
207-
return false;
207+
return new ActionResult("Cannot delete. Credential key not specified", isSuccess: false);
208208
}
209209

210210
var result = await _certifyClient.DeleteCredential(credentialKey);

0 commit comments

Comments
 (0)