-
-
Save DanyF-github/63d32bb865d95ae6b8437da635ac9d04 to your computer and use it in GitHub Desktop.
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
// client/src/pages/AddHomeworkFilePage.tsx | |
import React, {useState} from 'react'; | |
import { useParams } from 'react-router-dom'; | |
import { PasswordlessLogin, HomeworkFileForm } from '../components/Homeworks'; | |
const AddHomeworkFilePage = () => { | |
// setup the state for storing the token | |
const [ token, setToken ] = useState<string | null>(null); | |
// get the homework uuid from the url | |
const { uuid } = useParams<{ uuid: string }>(); | |
// if a token exists show the homework form, if not show the login form | |
return token ? <HomeworkFileForm token={token as string} uuid={uuid} /> : <PasswordlessLogin onLogin={(token) => setToken(token as string)} /> | |
} | |
export default AddHomeworkFilePage; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment