forked from fineanmol/Hacktoberfest2024
-
Notifications
You must be signed in to change notification settings - Fork 30
/
jj55
86 lines (79 loc) · 2.51 KB
/
jj55
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import React, {useContext} from 'react';
import Form from 'react-bootstrap/Form';
import Button from 'react-bootstrap/Button';
import { useHistory } from 'react-router-dom';
import "../../css/Allergy.css";
import Jumbotron from 'react-bootstrap/Jumbotron';
import { useHttpClient } from '../../shared/hooks/useHttpClient';
import {AuthContext} from '../../shared/util/AuthContext';
import { useParams } from "react-router-dom";
const ConfirmAppointment = () => {
const auth = useContext(AuthContext);
const history = useHistory();
const { isLoading, error, sendRequest, clearError } = useHttpClient();
const docID=useParams().docID;
const userID=useParams().userID;
const placeSubmitHandler=async event =>{
event.preventDefault();
var date = document.getElementById('AF'). value;
var time = document.getElementById('AR').value;
try {
await sendRequest(
'https://localhost:5000/api/users/bookanappointment',
'POST',
JSON.stringify({
date: date,
time:time,
docID: docID,
userID:userID,
}),
{ 'Content-Type': 'application/json' }
);
console.log("fuckit")
history.push('/');
}catch(err){}
};
return (
<div className="BGGradeAllergy">
<div className="TopMarginAllergy"></div>
<div className="box" id="heading">
<h1 className="Heading"> Appointment Confirmation</h1>{" "}
</div>
<Jumbotron className="container" bg-dark>
<Form className="form-signin" onSubmit={placeSubmitHandler}>
<Form.Group controlId="formGroupheart">
<Form.Label className="AllergyFormTextLabel">
Date
</Form.Label>
<Form.Control
type="text"
id="AF"
placeholder="Date"
className="AllergyFormText"
/>
</Form.Group>
<Form.Group controlId="formGroupBP">
<Form.Label className="AllergyFormTextLabel">
Time
</Form.Label>
<Form.Control
type="text"
id="AR"
className="AllergyFormText"
placeholder="Time"
/>
</Form.Group>
<br />
<Button
variant="primary"
type="submit"
className="AllergyButton"
>
Submit
</Button>
</Form>
</Jumbotron>
</div>
);
};
export default ConfirmAppointment;