Skip to content

Commit 05e2ecb

Browse files
committed
PR feedback updates
1 parent 984a8fb commit 05e2ecb

File tree

5 files changed

+26
-12
lines changed

5 files changed

+26
-12
lines changed

src/Umbraco.Cms.Integrations.Crm.ActiveCampaign/App_Plugins/UmbracoCms.Integrations/Crm/ActiveCampaign/js/formpicker.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
function getFormDetails(id) {
6161
vm.loading = true;
6262
umbracoCmsIntegrationsCrmActiveCampaignResource.getForm(id).then(function (response) {
63-
if (response.message !== null && response.message.length > 0)
63+
if (response.message && response.message.length > 0)
6464
vm.status = response.message;
6565
else
6666
vm.selectedForm = response.form;

src/Umbraco.Cms.Integrations.Crm.ActiveCampaign/Controllers/FormsController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ public async Task<IActionResult> GetForms()
3838
var content = await response.Content.ReadAsStringAsync();
3939

4040
if (!response.IsSuccessStatusCode)
41-
return new JsonResult(new ResponseDto
41+
return new JsonResult(new FormCollectionResponseDto
4242
{
4343
Message = string.IsNullOrEmpty(content)
4444
? response.StatusCode == System.Net.HttpStatusCode.Forbidden
4545
? Constants.Resources.AuthorizationFailed : Constants.Resources.ApiAccessFailed
4646
: JsonNode.Parse(content)["message"].ToString()
4747
});
4848

49-
return new JsonResult(JsonSerializer.Deserialize<ResponseDto>(content));
49+
return new JsonResult(JsonSerializer.Deserialize<FormCollectionResponseDto>(content));
5050
}
5151

5252
[HttpGet]
@@ -64,15 +64,15 @@ public async Task<IActionResult> GetForm(string id)
6464
var content = await response.Content.ReadAsStringAsync();
6565

6666
if (!response.IsSuccessStatusCode)
67-
return new JsonResult(new ResponseDto
67+
return new JsonResult(new FormResponseDto
6868
{
6969
Message = string.IsNullOrEmpty(content)
7070
? response.StatusCode == System.Net.HttpStatusCode.Forbidden
7171
? Constants.Resources.AuthorizationFailed : Constants.Resources.ApiAccessFailed
7272
: JsonNode.Parse(content)["message"].ToString()
7373
});
7474

75-
return new JsonResult(JsonSerializer.Deserialize<ResponseDto>(content));
75+
return new JsonResult(JsonSerializer.Deserialize<FormResponseDto>(content));
7676
}
7777

7878
}

src/Umbraco.Cms.Integrations.Crm.ActiveCampaign/Models/Dtos/ResponseDto.cs renamed to src/Umbraco.Cms.Integrations.Crm.ActiveCampaign/Models/Dtos/BaseResponseDto.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22

33
namespace Umbraco.Cms.Integrations.Crm.ActiveCampaign.Models.Dtos
44
{
5-
public class ResponseDto
5+
public abstract class BaseResponseDto
66
{
7-
[JsonPropertyName("form")]
8-
public FormDto Form { get; set; }
9-
10-
[JsonPropertyName("forms")]
11-
public List<FormDto> Forms { get; set; }
12-
137
[JsonPropertyName("message")]
148
public string Message { get; set; }
159
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace Umbraco.Cms.Integrations.Crm.ActiveCampaign.Models.Dtos
4+
{
5+
public class FormCollectionResponseDto : BaseResponseDto
6+
{
7+
[JsonPropertyName("forms")]
8+
public List<FormDto> Form { get; set; }
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace Umbraco.Cms.Integrations.Crm.ActiveCampaign.Models.Dtos
4+
{
5+
public class FormResponseDto : BaseResponseDto
6+
{
7+
[JsonPropertyName("form")]
8+
public FormDto Form { get; set; }
9+
}
10+
}

0 commit comments

Comments
 (0)