This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useState} from "react"; | |
import Container from "react-bootstrap/Container"; | |
import Row from "react-bootstrap/Row"; | |
import Col from "react-bootstrap/Col"; | |
import { usePagination } from "./paginationhook"; | |
import "bootstrap/dist/css/bootstrap.min.css"; | |
import Paginator from "./Paginator"; | |
function App() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
const displayItem = (currentPage: number, maxPerPage: number, index:number): boolean => { | |
const currentPageStart = ((currentPage - 1) * maxPerPage) + 1; | |
const currentPageEnd = currentPage * maxPerPage; | |
if ((index + 1) >= currentPageStart && (index + 1) <= currentPageEnd ) { | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private readonly UserService _userService; | |
private readonly IAntiforgery _antiforgery; | |
public UserApiController(UserService userService, | |
IAntiforgery antiforgery) | |
{ | |
_userService = userService; | |
_antiforgery = antiforgery; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class JwtCookieMiddleware | |
{ | |
/// <summary> | |
/// Checks the jwt cookie and sets the user for the application. | |
/// </summary> | |
/// <param name="app">App builder reference.</param> | |
/// <param name="antiforgery">Reference to the antiforgery service.</param> | |
/// <param name="key">The key to decrypt the token.</param> | |
/// <param name="autoRefresh">Creates a new token if the token is half past expiration time (and still valid).</param> | |
/// <param name="cookieName">Name of the cookie where the jwt is (defaults to jwt).</param> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
[Route("logout")] | |
public IActionResult Logout() | |
{ | |
HttpContext.User = new ClaimsPrincipal(); | |
RefreshCSRFToken(); | |
HttpContext.Response.Cookies.Delete("jwt"); | |
return Ok(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as express from "express"; | |
import ...; | |
import { createConnection } from "typeorm"; | |
const app = express(); | |
createConnection().then((connection) => { | |
app.use(...); | |
// Start other middleware and routes... | |
app.use(...); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createConnection, Connection, getConnection } from "typeorm"; | |
import { CONNECTION_STRING } from "./config"; | |
const setupTypeORM = async () => { | |
let connection: any = null; | |
while (connection == undefined || !connection.isConnected) | |
{ | |
try { |
OlderNewer