You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
728 B
24 lines
728 B
using System.Net.Http.Headers;
|
|
|
|
namespace Biskilog_Accounting.Client.Layouts
|
|
{
|
|
public partial class MainLayout
|
|
{
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
//Checks if user token is set else redirect user to login page
|
|
if (!await m_tokenService.IsTokenSet())
|
|
{
|
|
m_navigationManager.NavigateTo("/login");
|
|
}
|
|
else
|
|
{
|
|
string token = await m_tokenService.GetToken();
|
|
var authHeader = new AuthenticationHeaderValue("Bearer", token.Substring(6).Trim());
|
|
m_http.DefaultRequestHeaders.Authorization = authHeader;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|