Skip to content

Commit cdfacd2

Browse files
committed
added interceptor to main component . removed others. #20
1 parent 34278cc commit cdfacd2

17 files changed

Lines changed: 87 additions & 160 deletions

BlazorHero.CleanArchitecture/Client/Pages/Catalog/AddEditBrandModal.razor.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace BlazorHero.CleanArchitecture.Client.Pages.Catalog
99
{
10-
public partial class AddEditBrandModal : IDisposable
10+
public partial class AddEditBrandModal
1111
{
1212
private bool success;
1313
private string[] errors = { };
@@ -29,11 +29,6 @@ public partial class AddEditBrandModal : IDisposable
2929
public string Description { get; set; }
3030

3131
[CascadingParameter] private MudDialogInstance MudDialog { get; set; }
32-
protected override void OnInitialized()
33-
{
34-
_interceptor.RegisterEvent();
35-
}
36-
public void Dispose() => _interceptor.DisposeEvent();
3732
public void Cancel()
3833
{
3934
MudDialog.Cancel();

BlazorHero.CleanArchitecture/Client/Pages/Catalog/AddEditProductModal.razor.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace BlazorHero.CleanArchitecture.Client.Pages.Catalog
1212
{
13-
public partial class AddEditProductModal : IDisposable
13+
public partial class AddEditProductModal
1414
{
1515
private bool success;
1616
private string[] errors = { };
@@ -81,10 +81,8 @@ private async Task SaveAsync()
8181

8282
protected override async Task OnInitializedAsync()
8383
{
84-
_interceptor.RegisterEvent();
8584
await LoadDataAsync();
8685
}
87-
public void Dispose() => _interceptor.DisposeEvent();
8886

8987
private async Task LoadDataAsync()
9088
{

BlazorHero.CleanArchitecture/Client/Pages/Catalog/Brands.razor.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,15 @@
77

88
namespace BlazorHero.CleanArchitecture.Client.Pages.Catalog
99
{
10-
public partial class Brands : IDisposable
10+
public partial class Brands
1111
{
1212
public List<GetAllBrandsResponse> BrandList = new List<GetAllBrandsResponse>();
1313
private GetAllBrandsResponse brand = new GetAllBrandsResponse();
1414
private string searchString = "";
15-
1615
protected override async Task OnInitializedAsync()
1716
{
18-
_interceptor.RegisterEvent();
1917
await GetBrandsAsync();
2018
}
21-
public void Dispose() => _interceptor.DisposeEvent();
22-
2319
private async Task GetBrandsAsync()
2420
{
2521
var response = await _brandManager.GetAllAsync();

BlazorHero.CleanArchitecture/Client/Pages/Catalog/Products.razor.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,14 @@
99

1010
namespace BlazorHero.CleanArchitecture.Client.Pages.Catalog
1111
{
12-
public partial class Products : IDisposable
12+
public partial class Products
1313
{
1414
private IEnumerable<GetAllPagedProductsResponse> pagedData;
1515
private MudTable<GetAllPagedProductsResponse> table;
1616

1717
private int totalItems;
1818
private int currentPage;
1919
private string searchString = null;
20-
21-
protected override async Task OnInitializedAsync()
22-
{
23-
_interceptor.RegisterEvent();
24-
await Task.CompletedTask;
25-
}
26-
27-
public void Dispose() => _interceptor.DisposeEvent();
2820
private async Task<TableData<GetAllPagedProductsResponse>> ServerReload(TableState state)
2921
{
3022
await LoadData(state.Page, state.PageSize);

BlazorHero.CleanArchitecture/Client/Pages/Content/Dashboard.razor.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace BlazorHero.CleanArchitecture.Client.Pages.Content
88
{
9-
public partial class Dashboard : IDisposable
9+
public partial class Dashboard
1010
{
1111
[Parameter]
1212
public int ProductCount { get; set; }
@@ -19,12 +19,9 @@ public partial class Dashboard : IDisposable
1919

2020
protected override async Task OnInitializedAsync()
2121
{
22-
_interceptor.RegisterEvent();
2322
await LoadDataAsync();
2423
}
2524

26-
public void Dispose() => _interceptor.DisposeEvent();
27-
2825
private async Task LoadDataAsync()
2926
{
3027
var data = await _dashboardManager.GetDataAsync();

BlazorHero.CleanArchitecture/Client/Pages/Identity/Profile.razor.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ private async Task UpdateProfileAsync()
3737

3838
protected override async Task OnInitializedAsync()
3939
{
40-
_interceptor.RegisterEvent();
4140
await LoadDataAsync();
4241
}
43-
public void Dispose() => _interceptor.DisposeEvent();
44-
4542
private async Task LoadDataAsync()
4643
{
4744
var state = await _stateProvider.GetAuthenticationStateAsync();

BlazorHero.CleanArchitecture/Client/Pages/Identity/RegisterUserModal.razor.cs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace BlazorHero.CleanArchitecture.Client.Pages.Identity
1111
{
12-
public partial class RegisterUserModal : IDisposable
12+
public partial class RegisterUserModal
1313
{
1414
private bool success;
1515
private string[] errors = { };
@@ -52,33 +52,6 @@ public void Cancel()
5252
{
5353
MudDialog.Cancel();
5454
}
55-
[Parameter]
56-
public int ProductCount { get; set; }
57-
[Parameter]
58-
public int BrandCount { get; set; }
59-
[Parameter]
60-
public int UserCount { get; set; }
61-
[Parameter]
62-
public int RoleCount { get; set; }
63-
64-
protected override void OnInitialized()
65-
{
66-
_interceptor.RegisterEvent();
67-
}
68-
69-
public void Dispose() => _interceptor.DisposeEvent();
70-
71-
private async Task LoadDataAsync()
72-
{
73-
var data = await _dashboardManager.GetDataAsync();
74-
if (data.Succeeded)
75-
{
76-
ProductCount = data.Data.ProductCount;
77-
BrandCount = data.Data.BrandCount;
78-
UserCount = data.Data.UserCount;
79-
RoleCount = data.Data.RoleCount;
80-
}
81-
}
8255
private async Task SaveAsync()
8356
{
8457
form.Validate();
@@ -111,7 +84,6 @@ private async Task SaveAsync()
11184
}
11285
}
11386
}
114-
11587
private IEnumerable<string> PasswordStrength(string pw)
11688
{
11789
if (string.IsNullOrWhiteSpace(pw))

BlazorHero.CleanArchitecture/Client/Pages/Identity/RoleModal.razor.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace BlazorHero.CleanArchitecture.Client.Pages.Identity
99
{
10-
public partial class RoleModal : IDisposable
10+
public partial class RoleModal
1111
{
1212
private bool success;
1313
private string[] errors = { };
@@ -26,11 +26,6 @@ public void Cancel()
2626
{
2727
MudDialog.Cancel();
2828
}
29-
protected override void OnInitialized()
30-
{
31-
_interceptor.RegisterEvent();
32-
}
33-
public void Dispose() => _interceptor.DisposeEvent();
3429
private async Task SaveAsync()
3530
{
3631
form.Validate();

BlazorHero.CleanArchitecture/Client/Pages/Identity/RolePermissions.razor.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace BlazorHero.CleanArchitecture.Client.Pages.Identity
1111
{
12-
public partial class RolePermissions : IDisposable
12+
public partial class RolePermissions
1313
{
1414
[Parameter]
1515
public string Id { get; set; }
@@ -25,7 +25,6 @@ public partial class RolePermissions : IDisposable
2525

2626
protected override async Task OnInitializedAsync()
2727
{
28-
_interceptor.RegisterEvent();
2928
_mapper = new MapperConfiguration(c => { c.AddProfile<RoleProfile>(); }).CreateMapper();
3029
var roleId = Id;
3130
var result = await _roleManager.GetPermissionsAsync(roleId);
@@ -38,7 +37,6 @@ protected override async Task OnInitializedAsync()
3837
}
3938
}
4039
}
41-
public void Dispose() => _interceptor.DisposeEvent();
4240
private async Task SaveAsync()
4341
{
4442
var request = _mapper.Map<PermissionResponse, PermissionRequest>(model);

BlazorHero.CleanArchitecture/Client/Pages/Identity/Roles.razor.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@
77

88
namespace BlazorHero.CleanArchitecture.Client.Pages.Identity
99
{
10-
public partial class Roles : IDisposable
10+
public partial class Roles
1111
{
1212
public List<RoleResponse> RoleList = new List<RoleResponse>();
1313
private RoleResponse role = new RoleResponse();
1414
private string searchString = "";
1515

1616
protected override async Task OnInitializedAsync()
1717
{
18-
_interceptor.RegisterEvent();
1918
await GetRolesAsync();
2019
}
21-
public void Dispose() => _interceptor.DisposeEvent();
22-
2320
private async Task GetRolesAsync()
2421
{
2522
var response = await _roleManager.GetRolesAsync();

0 commit comments

Comments
 (0)