add user registration
This commit is contained in:
0
src/components/Registration.css
Normal file
0
src/components/Registration.css
Normal file
64
src/components/Registration.js
Normal file
64
src/components/Registration.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import React, { useState } from 'react';
|
||||
import moment from 'moment';
|
||||
import axios from 'axios';
|
||||
|
||||
import './ExportData.css';
|
||||
|
||||
function Registration() {
|
||||
const [userId, setUserId] = useState("2808202300103ROOBHO");
|
||||
const [counter, setCounter] = useState(0);
|
||||
|
||||
const createUser = () => {
|
||||
const id = moment().unix() + counter + "ROOBHO";
|
||||
setCounter(counter + 1);
|
||||
axios({
|
||||
method: 'post',
|
||||
url: "https://asia-south1-hpos-af3cc.cloudfunctions.net/registerUser",
|
||||
data: {
|
||||
"_id": id,
|
||||
"aadharId": "2808202300001",
|
||||
"abhaId": "12434949797979",
|
||||
"birthYear": "2000",
|
||||
"bloodGroup": "",
|
||||
"careOf": "",
|
||||
"caste": "",
|
||||
"city": "Bengaluru",
|
||||
"district": "Bengaluru",
|
||||
"gender": "Male",
|
||||
"house": "42",
|
||||
"maritalStatus": "Single",
|
||||
"name": "Web",
|
||||
"phoneNumber": "9123456789",
|
||||
"pinCode": "560060",
|
||||
"registeredBy": "admin",
|
||||
"registrationCenterName": "SMI",
|
||||
"sickleCellHistory": null,
|
||||
"state": "Karnataka",
|
||||
"subCaste": "",
|
||||
"testStatus": false,
|
||||
"underMedication": false,
|
||||
"underTransfusion": false,
|
||||
"userImageURL": "https://hpos-prod.web.app/logo.png"
|
||||
},
|
||||
withCredentials: false,
|
||||
secure: false,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"x-client": "e16a1bd15af2ee640f5a7a18c8d8333f5f01f7c66e003bbc21ee52870f1bce27",
|
||||
},
|
||||
})
|
||||
.then(response => response.data)
|
||||
.then((data) => {
|
||||
console.log(data);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className='dates'>
|
||||
<div className='button' onClick={() => createUser()}>Create User</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default Registration;
|
||||
@@ -26,7 +26,7 @@ class TestAnalyticsGraph extends Component {
|
||||
data.reverse();
|
||||
|
||||
var margin = { top: 30, right: 20, bottom: 50, left: 15 },
|
||||
width = 850 - margin.left - margin.right,
|
||||
width = 1500 - margin.left - margin.right,
|
||||
height = 180 - margin.top - margin.bottom;
|
||||
|
||||
var svg = d3.select("#tests-count-graph").append('svg')
|
||||
|
||||
@@ -6,6 +6,8 @@ import HomePage from '../components/HomePage';
|
||||
import Devices from '../components/Devices';
|
||||
import { Download } from '@mui/icons-material';
|
||||
import ExportData from '../components/ExportData';
|
||||
import Registration from '../components/Registration';
|
||||
import { FaUser } from 'react-icons/fa';
|
||||
|
||||
const appRoutes = [
|
||||
{
|
||||
@@ -32,14 +34,23 @@ const appRoutes = [
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/hposdata",
|
||||
path: "/downloaddata",
|
||||
element: <ExportData />,
|
||||
state: "hposdata",
|
||||
state: "downloaddata",
|
||||
sidebarProps: {
|
||||
displayText: "Data Download",
|
||||
icon: <Download />
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/registration",
|
||||
element: <Registration />,
|
||||
state: "registration",
|
||||
sidebarProps: {
|
||||
displayText: "Registration",
|
||||
icon: <FaUser />
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
export default appRoutes;
|
||||
Reference in New Issue
Block a user