mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 13:38:51 +00:00
Optimzed code and updated gitignore
This commit is contained in:
@@ -12,6 +12,8 @@ dist
|
|||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
|
|
||||||
|
src/db.json
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"name": "Nezumi",
|
|
||||||
"identifiedCode": "123",
|
|
||||||
"phone": "0937425123",
|
|
||||||
"roomId": 246,
|
|
||||||
"address": "Da Nang"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 3,
|
|
||||||
"name": "Nezumi",
|
|
||||||
"identifiedCode": "123",
|
|
||||||
"phone": "0937425123",
|
|
||||||
"roomId": 246,
|
|
||||||
"address": "Da Nang"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 4,
|
|
||||||
"name": "Nezumi",
|
|
||||||
"identifiedCode": "123",
|
|
||||||
"phone": "0937425123",
|
|
||||||
"roomId": 246,
|
|
||||||
"address": "Da Nang"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 5,
|
|
||||||
"name": "Nezumi",
|
|
||||||
"identifiedCode": "123",
|
|
||||||
"phone": "0937425123",
|
|
||||||
"roomId": 246,
|
|
||||||
"address": "Da Nang"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 6,
|
|
||||||
"name": "Nezumi",
|
|
||||||
"identifiedCode": "123",
|
|
||||||
"phone": "0937425123",
|
|
||||||
"roomId": 246,
|
|
||||||
"address": "Da Nang"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 8,
|
|
||||||
"name": "Nezumi",
|
|
||||||
"identifiedCode": "123",
|
|
||||||
"phone": "0937425123",
|
|
||||||
"roomId": 246,
|
|
||||||
"address": "Da Nang"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 9,
|
|
||||||
"name": "Nezumi",
|
|
||||||
"identifiedCode": "123",
|
|
||||||
"phone": "0937425123",
|
|
||||||
"roomId": 246,
|
|
||||||
"address": "Da Nang"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nezumi",
|
|
||||||
"identifiedCode": "3212",
|
|
||||||
"phone": "0327768351",
|
|
||||||
"roomId": "213",
|
|
||||||
"address": "32131212312",
|
|
||||||
"id": 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nezumi",
|
|
||||||
"identifiedCode": "123",
|
|
||||||
"phone": "0937425123",
|
|
||||||
"roomId": "24632",
|
|
||||||
"address": "Da Nang232321",
|
|
||||||
"id": 13
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 17,
|
|
||||||
"name": "Phan Huu Loi",
|
|
||||||
"identifiedCode": "123",
|
|
||||||
"phone": "0937425123",
|
|
||||||
"roomId": "246",
|
|
||||||
"address": "233123132131321"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -66,13 +66,11 @@ const UserForm = ({
|
|||||||
isAdd,
|
isAdd,
|
||||||
}: IUserFormProp) => {
|
}: IUserFormProp) => {
|
||||||
const [reset, setReset] = useState(true);
|
const [reset, setReset] = useState(true);
|
||||||
let initialValue: string = '';
|
// prettier-ignore
|
||||||
|
const initialValue: string = isAdd
|
||||||
if (isAdd) {
|
? ''
|
||||||
initialValue = '';
|
: user!
|
||||||
} else if (user) {
|
&& user.id;
|
||||||
initialValue = user.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define your state schema
|
// Define your state schema
|
||||||
const stateSchema: TStateSchema = {
|
const stateSchema: TStateSchema = {
|
||||||
|
|||||||
Reference in New Issue
Block a user