Browse Source
* - Using cdnjs not nuget on bootstrap and signalr. - Bootstrap modal used for add, edit details and delete. * EditForm inside modal-content * Top close button action added * Removed unused using. * DeleteCookies moved inside AuthService * ApplicationCore removed from BlazorAdmin dependencies * SecureHttpClient removed * Logout from identity manager added * last thing to do in logout from admin is LogoutIdentityManager. * JSRuntime used in AuthService without pass to the functions * Link fixed when logout from MVCmain
committed by
GitHub
26 changed files with 531 additions and 515 deletions
@ -1,37 +0,0 @@ |
|||
using Microsoft.AspNetCore.Components.WebAssembly.Authentication; |
|||
using System.Collections.Generic; |
|||
using System.Net.Http; |
|||
using System.Net.Http.Json; |
|||
using System.Threading.Tasks; |
|||
using BlazorAdmin.Services.CatalogBrandService; |
|||
|
|||
namespace BlazorAdmin.Network |
|||
{ |
|||
public class SecureHttpClient |
|||
{ |
|||
private readonly HttpClient client; |
|||
|
|||
public SecureHttpClient(HttpClient client) |
|||
{ |
|||
this.client = client; |
|||
|
|||
this.client.DefaultRequestHeaders.Add("Authorization", $"Bearer "); |
|||
} |
|||
|
|||
public async Task<List<CatalogBrand>> GetCatalogBrandsAsync() |
|||
{ |
|||
var brands = new List<CatalogBrand>(); |
|||
|
|||
try |
|||
{ |
|||
brands = (await client.GetFromJsonAsync<CatalogBrandResult>($"{Constants.API_URL}catalog-brands")).CatalogBrands; |
|||
} |
|||
catch (AccessTokenNotAvailableException exception) |
|||
{ |
|||
exception.Redirect(); |
|||
} |
|||
|
|||
return brands; |
|||
} |
|||
} |
|||
} |
|||
@ -1,27 +1,15 @@ |
|||
@page "/logout" |
|||
@inject AuthService AuthService |
|||
@inject NavigationManager NavigationManager |
|||
@inject IJSRuntime JSRuntime |
|||
@inherits BlazorAdmin.Helpers.BlazorComponent |
|||
|
|||
|
|||
@code { |
|||
|
|||
|
|||
protected override async Task OnInitializedAsync() |
|||
{ |
|||
await AuthService.Logout(); |
|||
await DeleteCookies(); |
|||
|
|||
CallRequestRefresh(); |
|||
await new Route(JSRuntime).RouteOutside("/Identity/Account/Login"); |
|||
} |
|||
|
|||
private async Task DeleteCookies() |
|||
{ |
|||
await new Cookies(JSRuntime).DeleteCookie("token"); |
|||
await new Cookies(JSRuntime).DeleteCookie("username"); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
@ -1,9 +1,9 @@ |
|||
@inject NavigationManager Navigation |
|||
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication |
|||
|
|||
@code { |
|||
protected override void OnInitialized() |
|||
{ |
|||
Navigation.NavigateTo($"authentication/login?returnUrl=" + |
|||
Navigation.NavigateTo($"Identity/Account/Login?returnUrl=" + |
|||
Uri.EscapeDataString(Navigation.Uri)); |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
|
|||
@inherits BlazorAdmin.Helpers.BlazorComponent |
|||
|
|||
@namespace BlazorAdmin.Shared |
|||
|
|||
<div class="spinner-border" role="status"> |
|||
<span class="sr-only">Loading...</span> |
|||
</div> |
|||
|
|||
Loading…
Reference in new issue