Skip to content

Commit cdf48b9

Browse files
toaster added for unauthorized message
1 parent 986677e commit cdf48b9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

ApiIntegrationMvc/Views/Shared/_Layout.cshtml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<link rel="stylesheet" href="https://cdn.datatables.net/2.1.8/css/dataTables.bootstrap5.css" />
1616
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/3.0.3/css/responsive.bootstrap5.css" />
1717

18+
<!-- PNotify CSS -->
19+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" />
20+
1821
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
1922
<link rel="stylesheet" href="~/ApiIntegrationMvc.styles.css" asp-append-version="true" />
2023

@@ -135,6 +138,9 @@
135138

136139
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
137140

141+
<!-- PNotify JS -->
142+
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
143+
138144
<script src="~/js/site.js" asp-append-version="true"></script>
139145
@await RenderSectionAsync("Scripts", required: false)
140146

@@ -150,6 +156,22 @@
150156
});
151157
152158
</script>
159+
160+
<!-- your site JS files here -->
161+
@* PNotify alert for TempData *@
162+
@{
163+
var error = TempData["Error"] as string;
164+
}
165+
166+
@if (!string.IsNullOrEmpty(error))
167+
{
168+
<script>
169+
document.addEventListener("DOMContentLoaded", () => {
170+
toastr.options.closeButton = true;
171+
toastr.error('@error', 'Access Denied');
172+
});
173+
</script>
174+
}
153175

154176
</body>
155177
</html>

0 commit comments

Comments
 (0)