🤞
This commit is contained in:
45
client/src/pages/Dashboard.tsx
Normal file
45
client/src/pages/Dashboard.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import React from 'react'
|
||||
import { useState } from 'react'
|
||||
import { useHistory } from 'react-router-dom'
|
||||
import { createClient } from '../api'
|
||||
|
||||
export const Dashboard = () => {
|
||||
const history = useHistory()
|
||||
const [name, setName] = useState('')
|
||||
const [email, setEmail] = useState('')
|
||||
const [phone, setPhone] = useState('')
|
||||
|
||||
const handleReset = () => {
|
||||
//
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
// phone number is stripped for numbers
|
||||
|
||||
await createClient({ name, email, phone })
|
||||
history.push(`/sessions/${phone}`)
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Dashboard</h1>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<label htmlFor="name">
|
||||
Name:
|
||||
<input type="text" name="name" />
|
||||
</label>
|
||||
<label htmlFor="email">
|
||||
Email:
|
||||
<input type="email" name="email" />
|
||||
</label>
|
||||
<label htmlFor="phone">
|
||||
Phone:
|
||||
<input type="phone" name="phone" />
|
||||
</label>
|
||||
<button type="submit">Start Session</button>
|
||||
<button onClick={handleReset}>Reset</button>
|
||||
</form>
|
||||
<div>TODO: List of past sessions for review?</div>
|
||||
</div>
|
||||
)
|
||||
}
|
15
client/src/pages/Session.tsx
Normal file
15
client/src/pages/Session.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from 'react'
|
||||
import { useEffect } from 'react'
|
||||
import { RouteComponentProps } from 'react-router-dom'
|
||||
|
||||
type Props = RouteComponentProps<{ clientId: string }>
|
||||
|
||||
export const Session = (props: Props) => {
|
||||
const { clientId } = props.match.params
|
||||
|
||||
const [submitted, setSubmitted] = useState(false)
|
||||
|
||||
useEffect(() => {})
|
||||
|
||||
return <div>Session {clientId}</div>
|
||||
}
|
Reference in New Issue
Block a user