show user id after user registration

This commit is contained in:
Pritimay Sarkar
2023-08-28 18:23:39 +05:30
parent 9893161684
commit cde2485a60
2 changed files with 14 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
.message {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 80vw;
height: 50px;
background-color: rgb(187, 218, 174);
}

View File

@@ -2,13 +2,15 @@ import React, { useState } from 'react';
import moment from 'moment';
import axios from 'axios';
import './ExportData.css';
import './Registration.css';
function Registration() {
const [userId, setUserId] = useState("2808202300103ROOBHO");
const [counter, setCounter] = useState(0);
const [message, setMessage] = useState("");
const createUser = () => {
setMessage("");
const id = moment().unix() + counter + "ROOBHO";
setCounter(counter + 1);
axios({
@@ -49,7 +51,7 @@ function Registration() {
})
.then(response => response.data)
.then((data) => {
console.log(data);
setMessage(`${id} is being created`);
});
}
@@ -58,6 +60,7 @@ function Registration() {
<div className='dates'>
<div className='button' onClick={() => createUser()}>Create User</div>
</div>
<div>{message && <div className='message'>{message}</div>}</div>
</div>
);
}