File tree Expand file tree Collapse file tree 4 files changed +25
-13
lines changed
Expand file tree Collapse file tree 4 files changed +25
-13
lines changed Original file line number Diff line number Diff line change 1313 "license" : " ISC" ,
1414 "description" : " " ,
1515 "devDependencies" : {
16+ "@types/axios" : " ^0.14.4" ,
1617 "@types/jest" : " ^29.5.14" ,
18+ "@types/jsonwebtoken" : " ^9.0.7" ,
1719 "@types/node" : " ^22.7.6" ,
1820 "@types/sqlite3" : " ^3.1.11" ,
1921 "jest" : " ^29.7.0" ,
2628 "@types/body-parser" : " ^1.19.5" ,
2729 "@types/cors" : " ^2.8.17" ,
2830 "@types/express" : " ^5.0.0" ,
31+ "axios" : " ^1.7.8" ,
2932 "body-parser" : " ^1.20.3" ,
3033 "cors" : " ^2.8.5" ,
3134 "dotenv" : " ^16.4.5" ,
3235 "express" : " ^4.21.1" ,
36+ "jsonwebtoken" : " ^9.0.2" ,
3337 "openai" : " ^4.67.3" ,
3438 "sqlite" : " ^5.1.1" ,
3539 "sqlite3" : " ^5.1.7"
Original file line number Diff line number Diff line change 11import React , { useEffect } from 'react' ;
22
3- const BACKEND_URL = 'https://localhost:3000 ' ; // Replace with your backend URL
3+ const BACKEND_URL = 'https://starr-lab-server.usask.ca/api ' ; // Replace with your backend URL
44
55const CASCallback : React . FC = ( ) => {
66 useEffect ( ( ) => {
Original file line number Diff line number Diff line change 11function redirectToCAS ( ) {
2- const CAS_SERVER = 'https://cas.usask.ca/cas' ;
3- const FRONTEND_URL = 'https://localhost:5173/' ;
4- const serviceURL = `${ FRONTEND_URL } /cas-callback` ;
5-
6- window . location . href = `${ CAS_SERVER } /login?service=${ encodeURIComponent ( serviceURL ) } ` ;
7- }
2+ const CAS_SERVER = "https://cas.usask.ca/cas" ;
3+ const FRONTEND_URL = "https://starr-lab-server.usask.ca:5173/" ;
4+ const serviceURL = `${ FRONTEND_URL } /cas-callback` ;
85
6+ window . location . href = `${ CAS_SERVER } /login?service=${ encodeURIComponent (
7+ serviceURL
8+ ) } `;
9+ }
910
10- export default function ProtectedRoute ( { children } : { children : JSX . Element } ) {
11- const token = localStorage . getItem ( 'jwt' ) ;
11+ export default function ProtectedRoute ( {
12+ children,
13+ } : {
14+ children : JSX . Element ;
15+ } ) {
16+ const token = localStorage . getItem ( "jwt" ) ;
1217
1318 if ( ! token ) {
1419 redirectToCAS ( ) ; // Redirect to CAS login if no JWT
1520 return null ; // Optional: Display a loading spinner while redirecting
1621 }
1722
1823 return children ;
19- } ;
20-
21-
22-
24+ }
Original file line number Diff line number Diff line change @@ -4,4 +4,10 @@ import react from '@vitejs/plugin-react'
44// https://vite.dev/config/
55export default defineConfig ( {
66 plugins : [ react ( ) ] ,
7+ server : {
8+ port : 5173 ,
9+ proxy : {
10+
11+ }
12+ }
713} )
You can’t perform that action at this time.
0 commit comments