-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into drag-and-drop
- Loading branch information
Showing
7 changed files
with
220 additions
and
62 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,49 @@ | ||
{ | ||
"name": "client", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"preview": "vite preview", | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"@auth0/auth0-react": "^2.2.4", | ||
"@headlessui/react": "^2.0.4", | ||
"@hello-pangea/dnd": "^16.6.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-router-dom": "^6.23.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/preset-react": "^7.24.7", | ||
"@babel/preset-typescript": "^7.24.7", | ||
"@testing-library/dom": "^10.1.0", | ||
"@testing-library/jest-dom": "^6.4.6", | ||
"@testing-library/react": "^16.0.0", | ||
"@types/jest": "^29.5.12", | ||
"@types/react": "^18.2.66", | ||
"@types/react-beautiful-dnd": "^13.1.8", | ||
"@types/react-dom": "^18.2.22", | ||
"@typescript-eslint/eslint-plugin": "^7.2.0", | ||
"@typescript-eslint/parser": "^7.2.0", | ||
"@vitejs/plugin-react": "^4.2.1", | ||
"autoprefixer": "^10.4.19", | ||
"babel-jest": "^29.7.0", | ||
"eslint": "^8.57.0", | ||
"eslint-plugin-jest": "^28.6.0", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-react-refresh": "^0.4.6", | ||
"jest": "^29.7.0", | ||
"postcss": "^8.4.38", | ||
"tailwindcss": "^3.4.4", | ||
"ts-jest": "^29.1.4", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.2.2", | ||
"vite": "^5.2.0" | ||
} | ||
"name": "client", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"preview": "vite preview", | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"@auth0/auth0-react": "^2.2.4", | ||
"@headlessui/react": "^2.0.4", | ||
"@hello-pangea/dnd": "^16.6.0", | ||
"axios": "^1.7.2", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-router-dom": "^6.23.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/preset-react": "^7.24.7", | ||
"@babel/preset-typescript": "^7.24.7", | ||
"@testing-library/dom": "^10.1.0", | ||
"@testing-library/jest-dom": "^6.4.6", | ||
"@testing-library/react": "^16.0.0", | ||
"@types/jest": "^29.5.12", | ||
"@types/react": "^18.2.66", | ||
"@types/react-beautiful-dnd": "^13.1.8", | ||
"@types/react-dom": "^18.2.22", | ||
"@typescript-eslint/eslint-plugin": "^7.2.0", | ||
"@typescript-eslint/parser": "^7.2.0", | ||
"@vitejs/plugin-react": "^4.2.1", | ||
"autoprefixer": "^10.4.19", | ||
"babel-jest": "^29.7.0", | ||
"eslint": "^8.57.0", | ||
"eslint-plugin-jest": "^28.6.0", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-react-refresh": "^0.4.6", | ||
"jest": "^29.7.0", | ||
"postcss": "^8.4.38", | ||
"tailwindcss": "^3.4.4", | ||
"ts-jest": "^29.1.4", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.2.2", | ||
"vite": "^5.2.0" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { useEffect } from "react"; | ||
import { useAuth0 } from "@auth0/auth0-react"; | ||
import axios from 'axios'; | ||
|
||
const AuthHandler: React.FC = () => { | ||
const { isAuthenticated, user, getIdTokenClaims } = useAuth0(); | ||
|
||
useEffect(() => { | ||
const handleAuthentication = async () => { | ||
if (isAuthenticated && user) { | ||
console.log('User is authenticated:', user); | ||
|
||
try { | ||
const endpoint = 'http://127.0.0.1:5000/api/signin' | ||
console.log({endpoint}); | ||
|
||
// Send data to the backend | ||
try { | ||
const response = await axios.post(endpoint, { | ||
email: user.email, | ||
}); | ||
console.log('User data sent to backend:', response.data); | ||
} catch (error) { | ||
console.error('Error sending user data to backend:', error); | ||
} | ||
} catch (error) { | ||
console.error('Error checking email existence:', error); | ||
} | ||
} else { | ||
console.log('User not authenticated or user object not available'); | ||
} | ||
}; | ||
|
||
handleAuthentication(); | ||
}, [isAuthenticated, user, getIdTokenClaims]); | ||
|
||
return null; | ||
}; | ||
|
||
export default AuthHandler; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import App from "./App.tsx"; | ||
import "./index.css"; | ||
import { Auth0Provider } from "@auth0/auth0-react"; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App.tsx'; | ||
import './index.css'; | ||
import { Auth0Provider } from '@auth0/auth0-react'; | ||
|
||
const domain = import.meta.env.VITE_AUTH0_DOMAIN; | ||
const clientId = import.meta.env.VITE_AUTH0_CLIENT_ID; | ||
|
||
ReactDOM.createRoot(document.getElementById("root")!).render( | ||
// <React.StrictMode> | ||
<Auth0Provider | ||
domain={domain} | ||
clientId={clientId} | ||
authorizationParams={{ redirect_uri: window.location.origin }} | ||
> | ||
<App /> | ||
</Auth0Provider> | ||
// </React.StrictMode>, | ||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<Auth0Provider | ||
domain={domain} | ||
clientId={clientId} | ||
authorizationParams={{ redirect_uri: window.location.origin }} | ||
> | ||
<App /> | ||
</Auth0Provider> | ||
</React.StrictMode>, | ||
); |
Binary file not shown.
This file contains 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