From 232975902c6bf6f884273f38479238d70b501b00 Mon Sep 17 00:00:00 2001 From: "hualin.zhu" Date: Sat, 14 Dec 2024 13:50:37 +0800 Subject: [PATCH] remove Tavenem.Blazor.IndexedDB --- src/CleanAspire.Api/CleanAspire.Api.csproj | 2 +- .../CleanAspire.Application.csproj | 2 +- .../Products/Queries/GetProductByIdQuery.cs | 1 - .../CleanAspire.ClientApp.csproj | 13 ++- .../Components/WebpushrSetup.razor | 13 ++- .../DependencyInjection.cs | 32 +------ .../IndexDb/LocalCredential.cs | 25 ------ .../IndexDb/LocalItemContext.cs | 18 ---- .../IndexDb/LocalProfileResponse.cs | 31 ------- .../IndexDb/LocalWebpushrOptions.cs | 23 ----- .../Pages/Products/Index.razor | 4 +- src/CleanAspire.ClientApp/Program.cs | 8 +- .../Services/DialogServiceHelper.cs | 1 - .../CookieAuthenticationStateProvider.cs | 65 +++----------- .../Services/JsInterop/IndexedDbCache.cs | 36 ++++++++ .../Services/JsInterop/Webpushr.cs | 1 - .../Services/Navigation/NavbarMenu.cs | 1 - .../Services/Proxies/ProductServiceProxy.cs | 41 +++++++++ .../Services/WebpushrAuthHandler.cs | 2 - .../Services/WebpushrService.cs | 1 - src/CleanAspire.ClientApp/wwwroot/index.html | 1 + .../wwwroot/js/indexeddbstorage.js | 87 +++++++++++++++++++ .../wwwroot/service-worker-assets.js | 1 - .../wwwroot/service-worker.js | 36 +------- 24 files changed, 201 insertions(+), 244 deletions(-) delete mode 100644 src/CleanAspire.ClientApp/IndexDb/LocalCredential.cs delete mode 100644 src/CleanAspire.ClientApp/IndexDb/LocalItemContext.cs delete mode 100644 src/CleanAspire.ClientApp/IndexDb/LocalProfileResponse.cs delete mode 100644 src/CleanAspire.ClientApp/IndexDb/LocalWebpushrOptions.cs create mode 100644 src/CleanAspire.ClientApp/Services/JsInterop/IndexedDbCache.cs create mode 100644 src/CleanAspire.ClientApp/Services/Proxies/ProductServiceProxy.cs create mode 100644 src/CleanAspire.ClientApp/wwwroot/js/indexeddbstorage.js delete mode 100644 src/CleanAspire.ClientApp/wwwroot/service-worker-assets.js diff --git a/src/CleanAspire.Api/CleanAspire.Api.csproj b/src/CleanAspire.Api/CleanAspire.Api.csproj index 0dc1f19..83eb66c 100644 --- a/src/CleanAspire.Api/CleanAspire.Api.csproj +++ b/src/CleanAspire.Api/CleanAspire.Api.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/CleanAspire.Application/CleanAspire.Application.csproj b/src/CleanAspire.Application/CleanAspire.Application.csproj index 66f8513..2b49a13 100644 --- a/src/CleanAspire.Application/CleanAspire.Application.csproj +++ b/src/CleanAspire.Application/CleanAspire.Application.csproj @@ -14,7 +14,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/CleanAspire.Application/Features/Products/Queries/GetProductByIdQuery.cs b/src/CleanAspire.Application/Features/Products/Queries/GetProductByIdQuery.cs index ebcdfbc..9b8163e 100644 --- a/src/CleanAspire.Application/Features/Products/Queries/GetProductByIdQuery.cs +++ b/src/CleanAspire.Application/Features/Products/Queries/GetProductByIdQuery.cs @@ -41,7 +41,6 @@ public GetProductByIdQueryHandler(IApplicationDbContext dbContext) { throw new KeyNotFoundException($"Product with Id '{request.Id}' was not found."); } - return product; } } diff --git a/src/CleanAspire.ClientApp/CleanAspire.ClientApp.csproj b/src/CleanAspire.ClientApp/CleanAspire.ClientApp.csproj index ab5181d..0f6007d 100644 --- a/src/CleanAspire.ClientApp/CleanAspire.ClientApp.csproj +++ b/src/CleanAspire.ClientApp/CleanAspire.ClientApp.csproj @@ -19,18 +19,17 @@ - - + + - - - - + + + + - diff --git a/src/CleanAspire.ClientApp/Components/WebpushrSetup.razor b/src/CleanAspire.ClientApp/Components/WebpushrSetup.razor index 15b349a..6616cc9 100644 --- a/src/CleanAspire.ClientApp/Components/WebpushrSetup.razor +++ b/src/CleanAspire.ClientApp/Components/WebpushrSetup.razor @@ -1,11 +1,16 @@ -@code { +@inject OnlineStatusInterop OnlineStatusInterop +@code { protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { - var publicKey = await WebpushrService.GetPublicKeyAsync(); - var webpushr = new Webpushr(JS); - await webpushr.SetupWebpushrAsync(publicKey!); + var online = await OnlineStatusInterop.GetOnlineStatusAsync(); + if (online) + { + var publicKey = await WebpushrService.GetPublicKeyAsync(); + var webpushr = new Webpushr(JS); + await webpushr.SetupWebpushrAsync(publicKey!); + } } } } diff --git a/src/CleanAspire.ClientApp/DependencyInjection.cs b/src/CleanAspire.ClientApp/DependencyInjection.cs index 363e2b5..2b60731 100644 --- a/src/CleanAspire.ClientApp/DependencyInjection.cs +++ b/src/CleanAspire.ClientApp/DependencyInjection.cs @@ -5,12 +5,7 @@ using CleanAspire.ClientApp.Services.Interfaces; using CleanAspire.ClientApp.Services.UserPreferences; using CleanAspire.ClientApp.Services; -using System.Text.Json; -using CleanAspire.ClientApp.IndexDb; -using System.Text.Json.Serialization.Metadata; -using CleanAspire.Api.Client.Models; -using System.Text.Json.Serialization; -using Tavenem.DataStorage; + namespace CleanAspire.ClientApp; public static class DependencyInjection @@ -49,30 +44,5 @@ public static void TryAddMudBlazor(this IServiceCollection services, IConfigurat #endregion } - public static void AddIndexedDbService(this IServiceCollection services, IConfiguration config) - { - var options = new JsonSerializerOptions(JsonSerializerDefaults.Web); - options.TypeInfoResolverChain.Add(LocalItemContext.Default.WithAddedModifier(static typeInfo => - { - if (typeInfo.Type == typeof(IIdItem)) - { - typeInfo.PolymorphismOptions ??= new JsonPolymorphismOptions - { - IgnoreUnrecognizedTypeDiscriminators = true, - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToNearestAncestor, - }; - typeInfo.PolymorphismOptions.DerivedTypes.Add(new JsonDerivedType(typeof(LocalCredential), LocalCredential.ItemTypeName)); - typeInfo.PolymorphismOptions.DerivedTypes.Add(new JsonDerivedType(typeof(LocalProfileResponse), LocalProfileResponse.ItemTypeName)); - } - })); - - services.AddIndexedDbService(); - services.AddIndexedDb( - LocalItemContext.DATABASENAME, - 1, - options); - } - - } diff --git a/src/CleanAspire.ClientApp/IndexDb/LocalCredential.cs b/src/CleanAspire.ClientApp/IndexDb/LocalCredential.cs deleted file mode 100644 index 178ee51..0000000 --- a/src/CleanAspire.ClientApp/IndexDb/LocalCredential.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Text.Json.Serialization; -using Tavenem.DataStorage; - -namespace CleanAspire.ClientApp.IndexDb; - -public class LocalCredential : IdItem -{ - [JsonInclude] - [JsonPropertyOrder(-1)] - public override string IdItemTypeName - { - get => ItemTypeName; - set { } - } - public const string ItemTypeName = ":LocalCredential:"; - public string? AccessToken { get; set; } - public long? ExpiresIn { get; set; } - public string? RefreshToken { get; set; } - public string? TokenType { get; set; } -} - diff --git a/src/CleanAspire.ClientApp/IndexDb/LocalItemContext.cs b/src/CleanAspire.ClientApp/IndexDb/LocalItemContext.cs deleted file mode 100644 index b16fe5a..0000000 --- a/src/CleanAspire.ClientApp/IndexDb/LocalItemContext.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Text.Json.Serialization; -using Tavenem.DataStorage; - -namespace CleanAspire.ClientApp.IndexDb; - -[JsonSerializable(typeof(IIdItem))] -[JsonSerializable(typeof(LocalProfileResponse))] -[JsonSerializable(typeof(LocalCredential))] -public partial class LocalItemContext : JsonSerializerContext -{ - public const string STORENAME = "LocalItemStore"; - public const string DATABASENAME = "CleanAspire.IndexedDB"; -} - diff --git a/src/CleanAspire.ClientApp/IndexDb/LocalProfileResponse.cs b/src/CleanAspire.ClientApp/IndexDb/LocalProfileResponse.cs deleted file mode 100644 index 1b1d13d..0000000 --- a/src/CleanAspire.ClientApp/IndexDb/LocalProfileResponse.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Text.Json.Serialization; -using Tavenem.DataStorage; - -namespace CleanAspire.ClientApp.IndexDb; - -public class LocalProfileResponse : IdItem -{ - [JsonInclude] - [JsonPropertyOrder(-1)] - public override string IdItemTypeName - { - get => ItemTypeName; - set { } - } - public const string ItemTypeName = ":LocalProfileResponse:"; - public string? Nickname { get; init; } - public string? Provider { get; init; } - public string? TenantId { get; init; } - public string? AvatarUrl { get; set; } - public required string UserId { get; init; } - public required string Username { get; init; } - public required string Email { get; init; } - public string? TimeZoneId { get; init; } - public string? LanguageCode { get; init; } - public string? SuperiorId { get; init; } -} - diff --git a/src/CleanAspire.ClientApp/IndexDb/LocalWebpushrOptions.cs b/src/CleanAspire.ClientApp/IndexDb/LocalWebpushrOptions.cs deleted file mode 100644 index 2296534..0000000 --- a/src/CleanAspire.ClientApp/IndexDb/LocalWebpushrOptions.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Text.Json.Serialization; -using Tavenem.DataStorage; - -namespace CleanAspire.ClientApp.IndexDb; - -public class LocalWebpushrOptions: IdItem -{ - [JsonInclude] - [JsonPropertyOrder(-1)] - public override string IdItemTypeName - { - get => ItemTypeName; - set { } - } - public const string ItemTypeName = ":WebpushrOptions:"; - public string? ApiKey { get; init; } - public string? PublicKey { get; init; } - public string? Token { get; init; } -} diff --git a/src/CleanAspire.ClientApp/Pages/Products/Index.razor b/src/CleanAspire.ClientApp/Pages/Products/Index.razor index 63bffc0..a2f3fdb 100644 --- a/src/CleanAspire.ClientApp/Pages/Products/Index.razor +++ b/src/CleanAspire.ClientApp/Pages/Products/Index.razor @@ -1,5 +1,7 @@ @page "/products/index" @using CleanAspire.ClientApp.Pages.Products.Components +@using CleanAspire.ClientApp.Services.Proxies +@inject ProductServiceProxy ProductServiceProxy @Title @@ -82,7 +84,7 @@ RowStyleFunc="_rowStyleFunc" query.Keywords = _keywords; query.OrderBy = state.SortDefinitions.FirstOrDefault()?.SortBy ?? "Id"; query.SortDirection = state.SortDefinitions.FirstOrDefault()?.Descending ?? true ? SortDirection.Descending.ToString() : SortDirection.Ascending.ToString(); - var result = await ApiClient.Products.Pagination.PostAsync(query); + var result = await ProductServiceProxy.GetProductsAsync(query); return new GridData { TotalItems = (int)result.TotalItems, Items = result.Items }; } finally diff --git a/src/CleanAspire.ClientApp/Program.cs b/src/CleanAspire.ClientApp/Program.cs index d436dde..743a031 100644 --- a/src/CleanAspire.ClientApp/Program.cs +++ b/src/CleanAspire.ClientApp/Program.cs @@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using CleanAspire.ClientApp; using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.Extensions.Options; using Microsoft.Kiota.Abstractions.Authentication; using Microsoft.Kiota.Http.HttpClientLibrary; using CleanAspire.ClientApp.Services.Identity; @@ -14,8 +13,8 @@ using Microsoft.Kiota.Serialization.Form; using Microsoft.Kiota.Serialization.Multipart; using CleanAspire.ClientApp.Services; -using Microsoft.Extensions.DependencyInjection; using CleanAspire.ClientApp.Services.JsInterop; +using CleanAspire.ClientApp.Services.Proxies; var builder = WebAssemblyHostBuilder.CreateDefault(args); @@ -28,6 +27,8 @@ builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); var clientAppSettings = builder.Configuration.GetSection(ClientAppSettings.KEY).Get(); builder.Services.AddSingleton(clientAppSettings!); @@ -88,11 +89,8 @@ builder.Services.AddLocalization(options => options.ResourcesPath = "Resources"); -builder.Services.AddIndexedDbService(builder.Configuration); - var app = builder.Build(); - await app.RunAsync(); diff --git a/src/CleanAspire.ClientApp/Services/DialogServiceHelper.cs b/src/CleanAspire.ClientApp/Services/DialogServiceHelper.cs index 35a82d8..74ce78c 100644 --- a/src/CleanAspire.ClientApp/Services/DialogServiceHelper.cs +++ b/src/CleanAspire.ClientApp/Services/DialogServiceHelper.cs @@ -1,6 +1,5 @@ using CleanAspire.ClientApp.Components; using Microsoft.AspNetCore.Components; -using Microsoft.Extensions.Options; using MudBlazor; namespace CleanAspire.ClientApp.Services; diff --git a/src/CleanAspire.ClientApp/Services/Identity/CookieAuthenticationStateProvider.cs b/src/CleanAspire.ClientApp/Services/Identity/CookieAuthenticationStateProvider.cs index 5e5425f..475d8eb 100644 --- a/src/CleanAspire.ClientApp/Services/Identity/CookieAuthenticationStateProvider.cs +++ b/src/CleanAspire.ClientApp/Services/Identity/CookieAuthenticationStateProvider.cs @@ -5,22 +5,24 @@ using System.Security.Claims; using CleanAspire.Api.Client; using CleanAspire.Api.Client.Models; -using CleanAspire.ClientApp.IndexDb; using CleanAspire.ClientApp.Services.JsInterop; using Microsoft.AspNetCore.Components.Authorization; + + + using Microsoft.Kiota.Abstractions; -using Tavenem.Blazor.IndexedDB; + namespace CleanAspire.ClientApp.Services.Identity; public class CookieAuthenticationStateProvider(ApiClient apiClient, UserProfileStore profileStore, IServiceProvider serviceProvider) : AuthenticationStateProvider, ISignInManagement { - + private const string CACHEKEY_CREDENTIAL = "_Credential"; private bool authenticated = false; private readonly ClaimsPrincipal unauthenticated = new(new ClaimsIdentity()); public override async Task GetAuthenticationStateAsync() { - var indexedDb = serviceProvider.GetRequiredKeyedService(LocalItemContext.DATABASENAME); + var indexedDb = serviceProvider.GetRequiredService(); var onlineStatusInterop = serviceProvider.GetRequiredService(); var offlineState = serviceProvider.GetRequiredService(); bool enableOffline = offlineState.Enabled; @@ -38,44 +40,12 @@ public override async Task GetAuthenticationStateAsync() // store the profile to indexedDB if (profileResponse != null && enableOffline) { - var exists = await indexedDb[LocalItemContext.STORENAME].Query().AnyAsync(x => x.UserId == profileResponse.UserId); - if (!exists) - { - await indexedDb[LocalItemContext.STORENAME].StoreItemAsync(new LocalProfileResponse() - { - AvatarUrl = profileResponse.AvatarUrl, - Email = profileResponse.Email, - LanguageCode = profileResponse.LanguageCode, - Nickname = profileResponse.Nickname, - Provider = profileResponse.Provider, - SuperiorId = profileResponse.SuperiorId, - TenantId = profileResponse.TenantId, - TimeZoneId = profileResponse.TimeZoneId, - UserId = profileResponse.UserId, - Username = profileResponse.Username, - }); - } + await indexedDb.SaveDataAsync(IndexedDbCache.DATABASENAME, CACHEKEY_CREDENTIAL, profileResponse); } } else if (enableOffline) { - var localProfile = await indexedDb[LocalItemContext.STORENAME].Query().FirstOrDefaultAsync(); - if (localProfile != null) - { - profileResponse = new ProfileResponse() - { - AvatarUrl = localProfile.AvatarUrl, - Email = localProfile.Email, - LanguageCode = localProfile.LanguageCode, - Nickname = localProfile.Nickname, - Provider = localProfile.Provider, - SuperiorId = localProfile.SuperiorId, - TenantId = localProfile.TenantId, - TimeZoneId = localProfile.TimeZoneId, - UserId = localProfile.UserId, - Username = localProfile.Username, - }; - } + profileResponse = await indexedDb.GetDataAsync(IndexedDbCache.DATABASENAME, CACHEKEY_CREDENTIAL); } profileStore.Set(profileResponse); @@ -105,7 +75,7 @@ await indexedDb[LocalItemContext.STORENAME].StoreItemAsync(new LocalProfileRespo public async Task LoginAsync(LoginRequest request, bool remember = true, CancellationToken cancellationToken = default) { - var indexedDb = serviceProvider.GetRequiredKeyedService("CleanAspire.IndexedDB"); + var indexedDb = serviceProvider.GetRequiredService(); var onlineStatusInterop = serviceProvider.GetRequiredService(); var offlineState = serviceProvider.GetRequiredService(); bool offlineModel = offlineState.Enabled; @@ -123,26 +93,13 @@ public async Task LoginAsync(LoginRequest request, bool remember = true, Cancell if (offlineModel) { // Store response in IndexedDB for offline access - var exists = await indexedDb[LocalItemContext.STORENAME].Query().AnyAsync(x => x.AccessToken == request.Email); - if (!exists) - { - await indexedDb[LocalItemContext.STORENAME].StoreItemAsync(new LocalCredential() - { - AccessToken = request.Email, - ExpiresIn = int.MaxValue, - RefreshToken = request.Email, - TokenType = "Email" - }); - } + await indexedDb.SaveDataAsync(IndexedDbCache.DATABASENAME,request.Email!, request.Email); } } else if (offlineModel) { // Offline login logic - var storedToken = await indexedDb[LocalItemContext.STORENAME] - .Query() - .FirstOrDefaultAsync(x => x.AccessToken == request.Email); - + var storedToken = await indexedDb.GetDataAsync(IndexedDbCache.DATABASENAME, request.Email!); if (storedToken == null) { throw new InvalidOperationException("No offline data available for the provided email."); diff --git a/src/CleanAspire.ClientApp/Services/JsInterop/IndexedDbCache.cs b/src/CleanAspire.ClientApp/Services/JsInterop/IndexedDbCache.cs new file mode 100644 index 0000000..4c6c790 --- /dev/null +++ b/src/CleanAspire.ClientApp/Services/JsInterop/IndexedDbCache.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.JSInterop; + +namespace CleanAspire.ClientApp.Services.JsInterop; + +public class IndexedDbCache +{ + public const string DATABASENAME = "CleanAspire.IndexedDB"; + private readonly IJSRuntime _jsRuntime; + + public IndexedDbCache(IJSRuntime jsRuntime) + { + _jsRuntime = jsRuntime; + } + + // Save data to IndexedDB (generic version) + public async Task SaveDataAsync(string dbName, string key, T value) + { + await _jsRuntime.InvokeVoidAsync("indexedDbStorage.saveData", dbName, key, value); + } + + // Get data from IndexedDB (generic version) + public async Task GetDataAsync(string dbName, string key) + { + return await _jsRuntime.InvokeAsync("indexedDbStorage.getData", dbName, key); + } + + // Clear all data from IndexedDB store + public async Task ClearDataAsync(string dbName) + { + await _jsRuntime.InvokeVoidAsync("indexedDbStorage.clearData", dbName); + } +} diff --git a/src/CleanAspire.ClientApp/Services/JsInterop/Webpushr.cs b/src/CleanAspire.ClientApp/Services/JsInterop/Webpushr.cs index abe8ed2..817bac0 100644 --- a/src/CleanAspire.ClientApp/Services/JsInterop/Webpushr.cs +++ b/src/CleanAspire.ClientApp/Services/JsInterop/Webpushr.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using CleanAspire.Api.Client; using Microsoft.JSInterop; namespace CleanAspire.ClientApp.Services.JsInterop; diff --git a/src/CleanAspire.ClientApp/Services/Navigation/NavbarMenu.cs b/src/CleanAspire.ClientApp/Services/Navigation/NavbarMenu.cs index 98c8480..eb5903f 100644 --- a/src/CleanAspire.ClientApp/Services/Navigation/NavbarMenu.cs +++ b/src/CleanAspire.ClientApp/Services/Navigation/NavbarMenu.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using MudBlazor; -using static MudBlazor.CategoryTypes; namespace CleanAspire.ClientApp.Services.Navigation; diff --git a/src/CleanAspire.ClientApp/Services/Proxies/ProductServiceProxy.cs b/src/CleanAspire.ClientApp/Services/Proxies/ProductServiceProxy.cs new file mode 100644 index 0000000..7569403 --- /dev/null +++ b/src/CleanAspire.ClientApp/Services/Proxies/ProductServiceProxy.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using CleanAspire.Api.Client; +using CleanAspire.Api.Client.Models; +using CleanAspire.ClientApp.Services.JsInterop; + + +namespace CleanAspire.ClientApp.Services.Proxies; + +public class ProductServiceProxy(ApiClient apiClient, IndexedDbCache indexedDb, OnlineStatusInterop onlineStatus, OfflineModeState offlineMode) +{ + public async Task GetProductsAsync(ProductsWithPaginationQuery query) + { + var cacheKey = GenerateCacheKey(query); + if (await onlineStatus.GetOnlineStatusAsync()) + { + var apiResult = await apiClient.Products.Pagination.PostAsync(query); + if (apiResult != null && offlineMode.Enabled) + { + await indexedDb.SaveDataAsync(IndexedDbCache.DATABASENAME, cacheKey, apiResult); + } + return apiResult ?? new PaginatedResultOfProductDto(); + } + else + { + var cachResult = await indexedDb.GetDataAsync(IndexedDbCache.DATABASENAME, cacheKey); + if (cachResult != null) + { + return cachResult; + } + } + return new PaginatedResultOfProductDto(); + } + private string GenerateCacheKey(ProductsWithPaginationQuery query) + { + return $"{nameof(ProductsWithPaginationQuery)}:{query.PageNumber}_{query.PageSize}_{query.Keywords}_{query.OrderBy}_{query.SortDirection}"; + } +} + diff --git a/src/CleanAspire.ClientApp/Services/WebpushrAuthHandler.cs b/src/CleanAspire.ClientApp/Services/WebpushrAuthHandler.cs index 5886dd5..e65ff24 100644 --- a/src/CleanAspire.ClientApp/Services/WebpushrAuthHandler.cs +++ b/src/CleanAspire.ClientApp/Services/WebpushrAuthHandler.cs @@ -2,11 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Text.Json; using CleanAspire.Api.Client; using CleanAspire.Api.Client.Models; using CleanAspire.ClientApp.Services.Interfaces; -using Microsoft.JSInterop; namespace CleanAspire.ClientApp.Services; diff --git a/src/CleanAspire.ClientApp/Services/WebpushrService.cs b/src/CleanAspire.ClientApp/Services/WebpushrService.cs index 2b89da7..8f48b58 100644 --- a/src/CleanAspire.ClientApp/Services/WebpushrService.cs +++ b/src/CleanAspire.ClientApp/Services/WebpushrService.cs @@ -5,7 +5,6 @@ using System.Net.Http.Headers; using System.Text; using CleanAspire.Api.Client; -using CleanAspire.Api.Client.Models; using CleanAspire.ClientApp.Services.Interfaces; namespace CleanAspire.ClientApp.Services; diff --git a/src/CleanAspire.ClientApp/wwwroot/index.html b/src/CleanAspire.ClientApp/wwwroot/index.html index bf99549..8758b71 100644 --- a/src/CleanAspire.ClientApp/wwwroot/index.html +++ b/src/CleanAspire.ClientApp/wwwroot/index.html @@ -232,6 +232,7 @@ +