Files
hpos-web/src/components/Registration.js
2023-08-28 17:54:20 +05:30

64 lines
2.1 KiB
JavaScript

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;