diff --git a/README.md b/README.md
index 0cd70c2..628159c 100644
--- a/README.md
+++ b/README.md
@@ -1,94 +1,6 @@
-# React + TypeScript + Vite
-## Happy coding : )
+### Serverni ishga tushurish ushun terminalda qoydagi kamandani yozing janob
-# Main
-
-- Try to keep pages server component;
-- Use BEM
-- Use FC generic for Component
-- Use the same node version (v20.9.0)
-
-# Imports order
-
-- Next components and utils
-- React
-- Third libraries
-- React components
-- Utils
-- Style
-
-# Pages
-
-- Pages are stored in the app folder
-
-- Naming -> CategoriesPage, CategoryPage
-
-# Files
-
- File naming is `kebab-case`
-
-- User.jsx => bad
-- user.jsx => good
-
-
-
-- loginCard.jsx => bad
-- LoginCard.jsx => bad
-- login-card.jsx => good
-
-# Components
-
-- Creating component
- ```
- modal
- index.tsx
- style.scss
-
- card
- index.tsx
- style.scss
- ```
-- Component naming is PascalCase
-
- ```
-
- ```
-- Component is made without margin
-
-# Hooks
-
- Hooks naming is camelCase
-
- ```
- useFetch
- ```
-
-# Variables
-
- Sass folder -> variables.scss
-
-
-
-
-
-## Expanding the ESLint configuration
-
-If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
-
-- Configure the top-level `parserOptions` property like this:
-
-```js
-export default {
- // other rules...
- parserOptions: {
- ecmaVersion: 'latest',
- sourceType: 'module',
- project: ['./tsconfig.json', './tsconfig.node.json'],
- tsconfigRootDir: __dirname,
- },
-}
```
+npm run server
-- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
-- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
-- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
+```
\ No newline at end of file
diff --git a/index.html b/index.html
index 977e51c..a9cb862 100644
--- a/index.html
+++ b/index.html
@@ -3,11 +3,13 @@
-
+
+
+
Table API
diff --git a/package-lock.json b/package-lock.json
index 6e3f8e8..7b35b4e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,14 +9,18 @@
"version": "0.0.0",
"dependencies": {
"axios": "^1.6.8",
+ "json-server": "^1.0.0-alpha.23",
"react": "^18.2.0",
"react-bootstrap": "^2.10.2",
"react-dom": "^18.2.0",
- "sass": "^1.74.1"
+ "react-toastify": "^10.0.5",
+ "sass": "^1.74.1",
+ "uuid": "^9.0.1"
},
"devDependencies": {
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
+ "@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
@@ -1075,6 +1079,11 @@
"node": ">=14"
}
},
+ "node_modules/@polka/url": {
+ "version": "1.0.0-next.25",
+ "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.25.tgz",
+ "integrity": "sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ=="
+ },
"node_modules/@popperjs/core": {
"version": "2.11.8",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
@@ -1340,6 +1349,212 @@
"tslib": "^2.4.0"
}
},
+ "node_modules/@tinyhttp/accepts": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/accepts/-/accepts-2.2.1.tgz",
+ "integrity": "sha512-2DHJLSJX1gqR5F6nKuu7+hyCNoPRNOxvnQ11m0X8klkSVoBFBO2HMf3bJ8P+fmNv1e6RjHzHF+G+hJ3dxXIQXQ==",
+ "dependencies": {
+ "mime": "4.0.1",
+ "negotiator": "^0.6.3"
+ },
+ "engines": {
+ "node": ">=12.20.0"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/tinyhttp/tinyhttp?sponsor=1"
+ }
+ },
+ "node_modules/@tinyhttp/app": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/app/-/app-2.2.3.tgz",
+ "integrity": "sha512-njr499Tx9BwlnIGfJjTuqfPwaUSTsjhUeRq/jVtHJpS95UgWECH7kiq8+bEx6TFRXiNKpARZ6KJUemlMyV+iCg==",
+ "dependencies": {
+ "@tinyhttp/cookie": "2.1.0",
+ "@tinyhttp/proxy-addr": "2.1.3",
+ "@tinyhttp/req": "2.2.2",
+ "@tinyhttp/res": "2.2.2",
+ "@tinyhttp/router": "2.2.2",
+ "header-range-parser": "1.1.3",
+ "regexparam": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=14.21.3"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/tinyhttp/tinyhttp?sponsor=1"
+ }
+ },
+ "node_modules/@tinyhttp/content-disposition": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/content-disposition/-/content-disposition-2.2.0.tgz",
+ "integrity": "sha512-w1dJaSAtcCinOlT/YQg35RnFCOBbCHBGDVhH4yLoiJVtecRAJ2cYMf5HP+UhfbXURa38GC8fkRXO0vODDTjmeg==",
+ "engines": {
+ "node": ">=12.20.0"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/tinyhttp/tinyhttp?sponsor=1"
+ }
+ },
+ "node_modules/@tinyhttp/content-type": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/content-type/-/content-type-0.1.4.tgz",
+ "integrity": "sha512-dl6f3SHIJPYbhsW1oXdrqOmLSQF/Ctlv3JnNfXAE22kIP7FosqJHxkz/qj2gv465prG8ODKH5KEyhBkvwrueKQ==",
+ "engines": {
+ "node": ">=12.4"
+ }
+ },
+ "node_modules/@tinyhttp/cookie": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/cookie/-/cookie-2.1.0.tgz",
+ "integrity": "sha512-o56utxXvIuLTCtPm66r8lcyUufpw0RkO+u4wQrTbc6snyyGZZ9hHzGRxPyko0ks90ctOkLh0mNKn7YZaTWlvfw==",
+ "engines": {
+ "node": ">=12.20.0"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/tinyhttp/tinyhttp?sponsor=1"
+ }
+ },
+ "node_modules/@tinyhttp/cookie-signature": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/cookie-signature/-/cookie-signature-2.1.0.tgz",
+ "integrity": "sha512-bpOXBGf9rKoajtEG75O7xjwW+u2I/NNPkJWJTDdr6j7Vx0lG5R9Hnl3ty80Af4jwyo90ywXVpZIxKLubPK6RzA==",
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/cors": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/cors/-/cors-2.0.0.tgz",
+ "integrity": "sha512-IwQsPBnK+gRrhTsPA4FPOfbNzZZt8cVsOIMNFb6HzoScaiWcoLEogL0Bz/aBSm8KM13uieVXoVT6udMqhqUS2A==",
+ "dependencies": {
+ "es-vary": "^0.1.1"
+ },
+ "engines": {
+ "node": ">=12.4 || 14.x || >=16"
+ }
+ },
+ "node_modules/@tinyhttp/encode-url": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/encode-url/-/encode-url-2.1.1.tgz",
+ "integrity": "sha512-AhY+JqdZ56qV77tzrBm0qThXORbsVjs/IOPgGCS7x/wWnsa/Bx30zDUU/jPAUcSzNOzt860x9fhdGpzdqbUeUw==",
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/etag": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/etag/-/etag-2.1.1.tgz",
+ "integrity": "sha512-AcHGK1nMlKIHmlbg8bb8UY/KhiaAX17SAn3/6wlgwwdX4UizA8HETDfCH3KLdu2ZASokynuwVFNDJCo1DAawGw==",
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/forwarded": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/forwarded/-/forwarded-2.1.2.tgz",
+ "integrity": "sha512-9H/eulJ68ElY/+zYpTpNhZ7vxGV+cnwaR6+oQSm7bVgZMyuQfgROW/qvZuhmgDTIxnGMXst+Ba4ij6w6Krcs3w==",
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/proxy-addr": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/proxy-addr/-/proxy-addr-2.1.3.tgz",
+ "integrity": "sha512-Z0Q/0wEJpvall7LlBezXDy96CXLzPZb6xJawwEgsMXXQhmjb+r3EkpCBwMrWm2GlbJFL/UxKxpdumiNW3Ne06g==",
+ "dependencies": {
+ "@tinyhttp/forwarded": "2.1.2",
+ "ipaddr.js": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/req": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/req/-/req-2.2.2.tgz",
+ "integrity": "sha512-LaL/RFRro0qjOQ0g3vxE6i9bWl9hhv9en7opykzLU4NimFPg2C8wl7Qkoyc0mDuoRMQmWpq730PDWXSUmLiT2A==",
+ "dependencies": {
+ "@tinyhttp/accepts": "2.2.1",
+ "@tinyhttp/type-is": "2.2.2",
+ "@tinyhttp/url": "2.1.1",
+ "header-range-parser": "^1.1.3"
+ },
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/res": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/res/-/res-2.2.2.tgz",
+ "integrity": "sha512-YeEYFwozag2qO5xoTj1Df+d5l6MXUefxz3xbcJD6ASVqUQytTEYtOC0FjhQKLpTLjMJKlS4mkKmeIdDLFO9btg==",
+ "dependencies": {
+ "@tinyhttp/content-disposition": "2.2.0",
+ "@tinyhttp/cookie": "2.1.0",
+ "@tinyhttp/cookie-signature": "2.1.0",
+ "@tinyhttp/encode-url": "2.1.1",
+ "@tinyhttp/req": "2.2.2",
+ "@tinyhttp/send": "2.2.1",
+ "@tinyhttp/vary": "^0.1.3",
+ "es-escape-html": "^0.1.1",
+ "mime": "4.0.1"
+ },
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/router": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/router/-/router-2.2.2.tgz",
+ "integrity": "sha512-i+1ouhPyTqcuJuOsKqmo7i+YD++0RF2lQLhBpcTnsaegD2gTEa3xW2Pcz7spYQGo7K8PQYtOrL7m9b14+BEXqg==",
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/send": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/send/-/send-2.2.1.tgz",
+ "integrity": "sha512-uFW0fxmYIPpB5RKP2vpL8QuafjUrCBmBWxZMIhFb7uBQky87t7x1QdpRB0vc+w11a2kok+Nc8ClD5kc6CRJCFg==",
+ "dependencies": {
+ "@tinyhttp/content-type": "^0.1.4",
+ "@tinyhttp/etag": "2.1.1",
+ "mime": "4.0.1"
+ },
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/type-is": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/type-is/-/type-is-2.2.2.tgz",
+ "integrity": "sha512-DmTm0MkdrUxEPI2WBBoYJT0bitWx6+xeUd3lya1NGbKmYArzyUE+KVro/9y/h6Bxh+RaAKNeTCF4H/ksbe/ULQ==",
+ "dependencies": {
+ "@tinyhttp/content-type": "^0.1.4",
+ "mime": "4.0.1"
+ },
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/url": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/url/-/url-2.1.1.tgz",
+ "integrity": "sha512-POJeq2GQ5jI7Zrdmj22JqOijB5/GeX+LEX7DUdml1hUnGbJOTWDx7zf2b5cCERj7RoXL67zTgyzVblBJC+NJWg==",
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/@tinyhttp/vary": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/@tinyhttp/vary/-/vary-0.1.3.tgz",
+ "integrity": "sha512-SoL83sQXAGiHN1jm2VwLUWQSQeDAAl1ywOm6T0b0Cg1CZhVsjoiZadmjhxF6FHCCY7OHHVaLnTgSMxTPIDLxMg==",
+ "engines": {
+ "node": ">=12.20"
+ }
+ },
"node_modules/@types/babel__core": {
"version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
@@ -1430,6 +1645,12 @@
"integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==",
"dev": true
},
+ "node_modules/@types/uuid": {
+ "version": "9.0.8",
+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
+ "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==",
+ "dev": true
+ },
"node_modules/@types/warning": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/warning/-/warning-3.0.3.tgz",
@@ -1959,6 +2180,14 @@
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz",
"integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="
},
+ "node_modules/clsx": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz",
+ "integrity": "sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
@@ -2121,6 +2350,31 @@
"csstype": "^3.0.2"
}
},
+ "node_modules/dot-prop": {
+ "version": "8.0.2",
+ "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-8.0.2.tgz",
+ "integrity": "sha512-xaBe6ZT4DHPkg0k4Ytbvn5xoxgpG0jOS1dYxSOwAHPuNLjP3/OzN0gH55SrLqpx8cBfSaVt91lXYkApjb+nYdQ==",
+ "dependencies": {
+ "type-fest": "^3.8.0"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/dot-prop/node_modules/type-fest": {
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz",
+ "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==",
+ "engines": {
+ "node": ">=14.16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/eastasianwidth": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
@@ -2139,6 +2393,22 @@
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
"dev": true
},
+ "node_modules/es-escape-html": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/es-escape-html/-/es-escape-html-0.1.1.tgz",
+ "integrity": "sha512-yUx1o+8RsG7UlszmYPtks+dm6Lho2m8lgHMOsLJQsFI0R8XwUJwiMhM1M4E/S8QLeGyf6MkDV/pWgjQ0tdTSyQ==",
+ "engines": {
+ "node": ">=12.x"
+ }
+ },
+ "node_modules/es-vary": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/es-vary/-/es-vary-0.1.2.tgz",
+ "integrity": "sha512-pLqqZoOutAXQXyBJrUYVNM5fZngiOJYi1Xl4svQMrluTsqDUOQlBMw9EYgLrsWL6niDYn/Yd1y2Pj6GC+j/yjA==",
+ "engines": {
+ "node": ">=12.x"
+ }
+ },
"node_modules/esbuild": {
"version": "0.20.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz",
@@ -2477,6 +2747,17 @@
"node": ">=0.10.0"
}
},
+ "node_modules/eta": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/eta/-/eta-3.4.0.tgz",
+ "integrity": "sha512-tCsc7WXTjrTx4ZjYLplcqrI3o4mYJ+Z6YspeuGL8tbt/hHoMchwBwtKfwM09svEY86iRapY93vUqQttcNuIO5Q==",
+ "engines": {
+ "node": ">=6.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/eta-dev/eta?sponsor=1"
+ }
+ },
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -2805,6 +3086,14 @@
"node": ">= 0.4"
}
},
+ "node_modules/header-range-parser": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/header-range-parser/-/header-range-parser-1.1.3.tgz",
+ "integrity": "sha512-B9zCFt3jH8g09LR1vHL4pcAn8yMEtlSlOUdQemzHMRKMImNIhhszdeosYFfNW0WXKQtXIlWB+O4owHJKvEJYaA==",
+ "engines": {
+ "node": ">=12.22.0"
+ }
+ },
"node_modules/ignore": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",
@@ -2844,6 +3133,14 @@
"node": ">=0.8.19"
}
},
+ "node_modules/inflection": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/inflection/-/inflection-3.0.0.tgz",
+ "integrity": "sha512-1zEJU1l19SgJlmwqsEyFTbScw/tkMHFenUo//Y0i+XEP83gDFdMvPizAD/WGcE+l1ku12PcTVHQhO6g5E0UCMw==",
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
"node_modules/inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@@ -2868,6 +3165,14 @@
"loose-envify": "^1.0.0"
}
},
+ "node_modules/ipaddr.js": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz",
+ "integrity": "sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ==",
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
@@ -3010,6 +3315,42 @@
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true
},
+ "node_modules/json-server": {
+ "version": "1.0.0-alpha.23",
+ "resolved": "https://registry.npmjs.org/json-server/-/json-server-1.0.0-alpha.23.tgz",
+ "integrity": "sha512-FPL1veNELhkr3tttwbIutKPkc/AUfLWSmslTwLYYPzl9RbCJQrwSPJceYWg2LnK1cv20tcEMLI2Kxl1lHz155Q==",
+ "dependencies": {
+ "@tinyhttp/app": "^2.2.3",
+ "@tinyhttp/cors": "^2.0.0",
+ "chalk": "^5.3.0",
+ "chokidar": "^3.5.3",
+ "dot-prop": "^8.0.2",
+ "eta": "^3.2.0",
+ "inflection": "^3.0.0",
+ "json5": "^2.2.3",
+ "lowdb": "^7.0.1",
+ "milliparsec": "^2.3.0",
+ "sirv": "^2.0.4",
+ "sort-on": "^6.0.0"
+ },
+ "bin": {
+ "json-server": "lib/bin.js"
+ },
+ "engines": {
+ "node": ">=18.3"
+ }
+ },
+ "node_modules/json-server/node_modules/chalk": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz",
+ "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==",
+ "engines": {
+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
"node_modules/json-stable-stringify-without-jsonify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
@@ -3020,7 +3361,6 @@
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
- "dev": true,
"bin": {
"json5": "lib/cli.js"
},
@@ -3097,6 +3437,20 @@
"loose-envify": "cli.js"
}
},
+ "node_modules/lowdb": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/lowdb/-/lowdb-7.0.1.tgz",
+ "integrity": "sha512-neJAj8GwF0e8EpycYIDFqEPcx9Qz4GUho20jWFR7YiFeXzF1YMLdxB36PypcTSPMA+4+LvgyMacYhlr18Zlymw==",
+ "dependencies": {
+ "steno": "^4.0.2"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/typicode"
+ }
+ },
"node_modules/lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
@@ -3128,6 +3482,28 @@
"node": ">=8.6"
}
},
+ "node_modules/milliparsec": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/milliparsec/-/milliparsec-2.3.0.tgz",
+ "integrity": "sha512-b+6KYJw+DwQjk24qCUuq+lZvRXDpXJ02qsllKgKaDurHpQ0v7D5op9VAkdYM/pXRhFeh7uLYHmnwFnYvdXGa3A==",
+ "engines": {
+ "node": ">=12.4"
+ }
+ },
+ "node_modules/mime": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-4.0.1.tgz",
+ "integrity": "sha512-5lZ5tyrIfliMXzFtkYyekWbtRXObT9OWa8IwQ5uxTBDHucNNwniRqo0yInflj+iYi5CBa6qxadGzGarDfuEOxA==",
+ "funding": [
+ "https://github.com/sponsors/broofa"
+ ],
+ "bin": {
+ "mime": "bin/cli.js"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@@ -3171,6 +3547,14 @@
"node": ">=16 || 14 >=14.17"
}
},
+ "node_modules/mrmime": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz",
+ "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==",
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -3212,6 +3596,14 @@
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
"dev": true
},
+ "node_modules/negotiator": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/node-releases": {
"version": "2.0.14",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
@@ -3707,6 +4099,18 @@
"node": ">=0.10.0"
}
},
+ "node_modules/react-toastify": {
+ "version": "10.0.5",
+ "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-10.0.5.tgz",
+ "integrity": "sha512-mNKt2jBXJg4O7pSdbNUfDdTsK9FIdikfsIE/yUCxbAEXl4HMyJaivrVFcn3Elvt5xvCQYhUZm+hqTIu1UXM3Pw==",
+ "dependencies": {
+ "clsx": "^2.1.0"
+ },
+ "peerDependencies": {
+ "react": ">=18",
+ "react-dom": ">=18"
+ }
+ },
"node_modules/react-transition-group": {
"version": "4.4.5",
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",
@@ -3747,6 +4151,14 @@
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
},
+ "node_modules/regexparam": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/regexparam/-/regexparam-2.0.2.tgz",
+ "integrity": "sha512-A1PeDEYMrkLrfyOwv2jwihXbo9qxdGD3atBYQA9JJgreAx8/7rC6IUkWOw2NQlOxLp2wL0ifQbh1HuidDfYA6w==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/resolve": {
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
@@ -3945,6 +4357,19 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/sirv": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz",
+ "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==",
+ "dependencies": {
+ "@polka/url": "^1.0.0-next.24",
+ "mrmime": "^2.0.0",
+ "totalist": "^3.0.0"
+ },
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@@ -3954,6 +4379,20 @@
"node": ">=8"
}
},
+ "node_modules/sort-on": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/sort-on/-/sort-on-6.0.0.tgz",
+ "integrity": "sha512-d51VlJWoFQjp+cIZRyNusCyJdP5pLAw+H+sC4C2q6RhPBv+RAb/QXXck5q3Kdm7h/ot/kD2AlpGPDee8v+0qiA==",
+ "dependencies": {
+ "dot-prop": "^8.0.2"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/source-map-js": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
@@ -3962,6 +4401,17 @@
"node": ">=0.10.0"
}
},
+ "node_modules/steno": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/steno/-/steno-4.0.2.tgz",
+ "integrity": "sha512-yhPIQXjrlt1xv7dyPQg2P17URmXbuM5pdGkpiMB3RenprfiBlvK415Lctfe0eshk90oA7/tNq7WEiMK8RSP39A==",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/typicode"
+ }
+ },
"node_modules/string-width": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
@@ -4216,6 +4666,14 @@
"node": ">=8.0"
}
},
+ "node_modules/totalist": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz",
+ "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/ts-api-utils": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz",
@@ -4355,6 +4813,18 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"dev": true
},
+ "node_modules/uuid": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
+ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/vite": {
"version": "5.2.8",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.2.8.tgz",
diff --git a/package.json b/package.json
index 57f1ed1..469b447 100644
--- a/package.json
+++ b/package.json
@@ -7,18 +7,23 @@
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
- "preview": "vite preview"
+ "preview": "vite preview",
+ "server": "npx json-server --watch src/db/data.json --port 8888"
},
"dependencies": {
"axios": "^1.6.8",
+ "json-server": "^1.0.0-alpha.23",
"react": "^18.2.0",
"react-bootstrap": "^2.10.2",
"react-dom": "^18.2.0",
- "sass": "^1.74.1"
+ "react-toastify": "^10.0.5",
+ "sass": "^1.74.1",
+ "uuid": "^9.0.1"
},
"devDependencies": {
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
+ "@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
diff --git a/src/App.tsx b/src/App.tsx
index 1914760..dca4534 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,37 +1,231 @@
+import { useEffect, useState } from "react";
+
import Table from "react-bootstrap/Table";
+import axios from "axios";
+
+import { v4 as uuidv4 } from "uuid";
+import { ToastContainer, toast } from "react-toastify";
+import 'react-toastify/dist/ReactToastify.css';
+
const App = () => {
+ //interface
+ interface dataInterfas {
+ id: number | string;
+ name: string;
+ lastName: string;
+ phone: string;
+ active: boolean;
+ count: number | string;
+ }
+
+ // Data
+ const [data, setData] = useState([]);
+
+ // inputs valyuest
+ const [inputName, setInputName] = useState("");
+ const [inputLastName, setInputLastName] = useState("");
+ const [inputPhone, setInputPhone] = useState("");
+ const [inputCount, setInputCount] = useState("");
+ const [inputActive, setInputActive] = useState(false);
+
+ const inputNameChange = (e: any) => {
+ setInputName(e.target.value);
+ };
+
+ const inputLastNameChange = (e: any) => {
+ setInputLastName(e.target.value);
+ };
+
+ const inputPhoneChange = (e: any) => {
+ setInputPhone(e.target.value);
+ };
+
+ const inputCountChange = (e: any) => {
+ setInputCount(e.target.value);
+ };
+
+ const inputActiveChange = (e: any) => {
+ setInputActive(e.isTrusted);
+ };
+
+ // Fuction get request from server
+ async function getUsers() {
+ try {
+ const response = await axios.get("http://localhost:8888/users");
+ setData(response.data);
+ } catch (error) {
+ console.error(error);
+ }
+ }
+
+ // FUN USEEFFECT ===============================================
+ useEffect(() => {
+ getUsers();
+ }, []);
+
+ //function add user
+ const addUsr = (e:any) => {
+ e.preventDefault();
+ let nevData: dataInterfas = {
+ id: uuidv4(),
+ name: inputName,
+ lastName: inputLastName,
+ phone: inputPhone,
+ active: inputActive,
+ count: inputCount,
+ };
+
+ axios.post(`http://localhost:8888/users`, nevData);
+ setInputName("");
+ setInputLastName("");
+ setInputPhone("");
+ setInputCount("");
+ setInputActive(false);
+
+ toast.success("Add user !", {
+ position: "top-right",
+ });
+
+ setTimeout(() => {
+ getUsers();
+ }, 2000);
+ };
+
+ // function delete users
+ const deletUser = (id: number | string) => {
+ axios.delete(`http://localhost:8888/users/${id}`);
+
+ // getUsers();
+
+ toast.info("Delete user !", {
+ position: "top-right",
+ });
+
+ setTimeout(() => {
+ getUsers();
+ }, 2000);
+
+ //window.location.reload();
+ };
+
+ //function edit users
+ const editUser = (id: number | string) => {
+ alert(`"${id}" This user change feature is not yet complete`);
+ };
+
return (
-
+
+
+ {data.length > 0 ? (
+
+ ) : (
+
+ Sir, there is currently no user listed 😓, please add a user 😊
+
+ )}
+
);
};
export default App;
+
+// {
+// "id": "5",
+// "name": "Beking",
+// "lastName": "Bek",
+// "phone": "123",
+// "active": true,
+// "count": 14
+// }
diff --git a/src/db/data.json b/src/db/data.json
new file mode 100644
index 0000000..d90a672
--- /dev/null
+++ b/src/db/data.json
@@ -0,0 +1,3 @@
+{
+ "users": []
+}
\ No newline at end of file