diff --git a/hotel-management/.gitignore b/hotel-management/.gitignore index a547bf3..8cdfe8e 100644 --- a/hotel-management/.gitignore +++ b/hotel-management/.gitignore @@ -12,6 +12,8 @@ dist dist-ssr *.local +src/db.json + # Editor directories and files .vscode/* !.vscode/extensions.json diff --git a/hotel-management/db.json b/hotel-management/db.json deleted file mode 100644 index 292fdd4..0000000 --- a/hotel-management/db.json +++ /dev/null @@ -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" - } - ] -} \ No newline at end of file diff --git a/hotel-management/src/pages/User/Form.tsx b/hotel-management/src/pages/User/Form.tsx index 580974d..86fa0e9 100644 --- a/hotel-management/src/pages/User/Form.tsx +++ b/hotel-management/src/pages/User/Form.tsx @@ -66,13 +66,11 @@ const UserForm = ({ isAdd, }: IUserFormProp) => { const [reset, setReset] = useState(true); - let initialValue: string = ''; - - if (isAdd) { - initialValue = ''; - } else if (user) { - initialValue = user.id; - } + // prettier-ignore + const initialValue: string = isAdd + ? '' + : user! + && user.id; // Define your state schema const stateSchema: TStateSchema = {