Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log out button for personal pages and update middlewares #80

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CheckDrive.Web.Stores.Dashbord;
using CheckDrive.Web.Stores.Cars;
using CheckDrive.Web.Stores.Dashbord;
using CheckDrive.Web.ViewModels;
using Microsoft.AspNetCore.Mvc;

Expand Down
6 changes: 5 additions & 1 deletion CheckDrive.Web/CheckDrive.Web/Filters/ApiExceptionFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ public void OnException(ExceptionContext context)
if (context.Exception is ApiException exception)
{
int statusCode = (int)exception.StatusCode;
context.Result = new RedirectToActionResult("Error", "Home", new { statusCode });
if (statusCode == 401)
{
context.Result = new RedirectToActionResult("Index", "Auth", new { statusCode });
}

context.ExceptionHandled = true;
}
else
Expand Down
1 change: 1 addition & 0 deletions CheckDrive.Web/CheckDrive.Web/Service/ApiClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CheckDrive.Web.Constants;
using CheckDrive.Web.Exceptions;
using Microsoft.AspNetCore.Mvc;

namespace CheckDrive.Web.Service
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@model IEnumerable<CheckDrive.ApiContracts.DoctorReview.DoctorReviewDto>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.0/font/bootstrap-icons.min.css">


@{
ViewData["Title"] = "Index";
Expand All @@ -21,6 +23,12 @@
</div>
</div>
</div>
<!-- LogOut Link -->
<div class="col-md-4 text-right">
<a href="@Url.Action("Login", "Auth")" class="btn btn-outline-danger">
Profildan Chiqish <i class="bi bi-box-arrow-right" style="margin-left: 5px;"></i>
</a>
</div>
</div>

<div class="row justify-content-center">
Expand Down Expand Up @@ -109,7 +117,6 @@
<p class="h6 mb-0">@ViewBag.PageCount sahifadan @ViewBag.CurrentPage tasi ( umumiy ishchilar soni: @ViewBag.TotalCount)</p>
</div>
</div>

</div>
</form>

Expand Down Expand Up @@ -180,4 +187,17 @@
padding-right: 0;
padding-left: 0;
}

.text-right {
text-align: right;
}

.btn-secondary {
background-color: #6c757d;
color: white;
}

.btn-secondary:hover {
background-color: #5a6268;
}
</style>
3 changes: 1 addition & 2 deletions CheckDrive.Web/CheckDrive.Web/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
<i class="fa-solid fa-user" style="background-color: white; color: black;"></i>
<i class="bi bi-caret-down-fill" style="background-color:white; color:black"></i>
</button>
<ul class="dropdown-menu" aria-labelledby="userDropdown">

<ul class="dropdown-menu" aria-labelledby="userDropdown">
<li><a class="dropdown-item" style="color: red" href="@Url.Action("Login", "Auth")">Profildan Chiqish</a></li>
</ul>
</div>
Expand Down
Loading