Skip to content

Commit

Permalink
Merge pull request #172 from fluentcms/171-cleanup-for-bootstrap-blaz…
Browse files Browse the repository at this point in the history
…or-server-app

#171 Program.cs cleanup and default page revision
  • Loading branch information
pournasserian authored Nov 16, 2023
2 parents 3515c1c + 7c26f06 commit f0d41b7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/FluentCMS.Web.UI/Layout/Sidebar.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ul class="nav flex-column">
<li class="nav-item">
<NavLink class="nav-link d-flex align-items-center gap-2" href="/admin" Match="NavLinkMatch.All">
<NavLink class="nav-link d-flex align-items-center gap-2" href="/" Match="NavLinkMatch.All">
Dashboard
</NavLink>
</li>
Expand Down
3 changes: 1 addition & 2 deletions src/FluentCMS.Web.UI/Pages/Home.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@page "/admin"
@page "/"

<PageTitle>Home</PageTitle>
<a href="api/WeatherForecast/GetAll" target="_blank">Call Weather Api</a>

<Label>This is label</Label>
<Button>Submit</Button>
Expand Down
29 changes: 13 additions & 16 deletions src/FluentCMS.Web.UI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

services.AddHttpContextAccessor();

// TODO: Add JWT to request header, accept-language, etc.
// TODO: Move to somewhere else
services.AddScoped(sp =>
{
var httpContextAccessor = sp.GetRequiredService<IHttpContextAccessor>();
Expand All @@ -46,7 +48,7 @@
};
});


// TODO: Move to somewhere else
#region Identity

var options = builder.Configuration.GetInstance<JwtOptions>("Jwt");
Expand Down Expand Up @@ -79,19 +81,22 @@
#endregion

var app = builder.Build();

app.Services.SeedDefaultData(@".\SeedData\");

if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.Services.SeedDefaultData(@".\SeedData\");
}
else
{
app.UseHsts();
app.UseHttpsRedirection();
app.UseExceptionHandler("/Error", createScopeForErrors: true);
}

app.UseHsts();

app.UseHttpsRedirection();

app.UseExceptionHandler("/Error", createScopeForErrors: true);

app.UseRouting();

app.UseStaticFiles();

app.UseAntiforgery();
Expand All @@ -102,14 +107,6 @@

app.UseAuthorization();

app.UseEndpoints(endpoints =>
{
_ = endpoints.MapGet("/", (context) =>
{
context.Response.Redirect("/admin");
return Task.CompletedTask;
});
});
app.MapControllers();

app.MapRazorComponents<App>()
Expand Down

0 comments on commit f0d41b7

Please sign in to comment.