Skip to content

Commit

Permalink
authentication changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nitheesh-aot committed Jul 31, 2024
1 parent 52d727c commit 4e8dd14
Show file tree
Hide file tree
Showing 7 changed files with 523 additions and 484 deletions.
1 change: 1 addition & 0 deletions compliance-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/BCFavIcon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="/config/config.js"></script>
<title>Epic.Compliance</title>
</head>
<body>
Expand Down
966 changes: 495 additions & 471 deletions compliance-web/package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions compliance-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"cy:open": "cypress open",
"cy:run-unit": "cypress run --component"
},
"dependencies": {
"@emotion/react": "^11.11.4",
Expand All @@ -20,7 +22,7 @@
"@tanstack/router-devtools": "^1.45.7",
"@tanstack/router-plugin": "^1.45.7",
"axios": "^1.7.2",
"epic.theme": "^1.0.3",
"epic.theme": "^1.0.4",
"keycloak-js": "^25.0.1",
"oidc-client-ts": "^3.0.1",
"react": "^18.2.0",
Expand Down
1 change: 1 addition & 0 deletions compliance-web/public/config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window['_env_'] = {};
23 changes: 16 additions & 7 deletions compliance-web/src/routes/_authenticated.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { createFileRoute } from '@tanstack/react-router'
import { createFileRoute, Outlet } from "@tanstack/react-router";
import { useEffect } from "react";
import { useAuth } from "react-oidc-context";

export const Route = createFileRoute('/_authenticated')({
beforeLoad: ({ context }) => {
const { isAuthenticated, signinRedirect } = context.authentication;
if (!isAuthenticated) {
export const Route = createFileRoute("/_authenticated")({
component: Auth,
});

function Auth() {
const { isAuthenticated, signinRedirect, isLoading } = useAuth();

useEffect(() => {
if (!isAuthenticated && !isLoading) {
signinRedirect();
}
},
})
}, [isAuthenticated, isLoading, signinRedirect]);

return <Outlet />;
}
3 changes: 0 additions & 3 deletions compliance-web/src/styles/App.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
:root {
font-family: 'BC Sans';
line-height: 1.5;
font-weight: 400;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
Expand Down
7 changes: 6 additions & 1 deletion compliance-web/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
"include": ["src"],
"exclude": [
"node_modules",
"**/*.test.tsx", // Update this pattern if your tests use a different extension
"**/*.cy.tsx" // Or whichever extension you use for Cypress tests
],
}

0 comments on commit 4e8dd14

Please sign in to comment.