sg-frontend-starter 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.degitignore +14 -0
- package/.env +7 -0
- package/.env.example +5 -0
- package/README.md +111 -0
- package/eslint.config.js +39 -0
- package/index.html +13 -0
- package/package.json +37 -0
- package/public/vite.svg +1 -0
- package/src/App.css +121 -0
- package/src/App.jsx +91 -0
- package/src/assets/react.svg +1 -0
- package/src/components/TelefonEditModal.jsx +124 -0
- package/src/components/TelefonForm.jsx +64 -0
- package/src/components/TelefonGrid.jsx +80 -0
- package/src/index.css +29 -0
- package/src/main.jsx +11 -0
- package/src/services/api.js +83 -0
- package/vite.config.js +11 -0
package/.degitignore
ADDED
package/.env
ADDED
package/.env.example
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Telefon Kezelő Alkalmazás - React + Vite
|
|
2
|
+
|
|
3
|
+
Egy modern React alkalmazás telefonok és gyártók kezeléséhez Vite build toolal.
|
|
4
|
+
|
|
5
|
+
## Gyors Telepítés
|
|
6
|
+
|
|
7
|
+
### Degit segítségével (ajánlott)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx degit [GitHub-username]/react-starter my-app
|
|
11
|
+
cd my-app
|
|
12
|
+
npm install
|
|
13
|
+
npm run dev
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Helyettesítsd a `[GitHub-username]` helyére a GitHub felhasználónevedet!
|
|
17
|
+
|
|
18
|
+
### Klasszikus klónozás
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/[GitHub-username]/react-starter.git
|
|
22
|
+
cd react-starter
|
|
23
|
+
npm install
|
|
24
|
+
npm run dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Telepítési lépések
|
|
28
|
+
|
|
29
|
+
1. **Projekt klónozása/letöltése:**
|
|
30
|
+
```bash
|
|
31
|
+
npx degit [GitHub-username]/react-starter my-app
|
|
32
|
+
cd my-app
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. **Függőségek telepítése:**
|
|
36
|
+
```bash
|
|
37
|
+
npm install
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
3. **Environment konfigurálása:**
|
|
41
|
+
```bash
|
|
42
|
+
cp .env.example .env
|
|
43
|
+
```
|
|
44
|
+
Szerkeszd a `.env` fájlt a szükséges API végpontokkal.
|
|
45
|
+
|
|
46
|
+
4. **Fejlesztési szerver indítása:**
|
|
47
|
+
```bash
|
|
48
|
+
npm run dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
5. **Gyártáshoz való build:**
|
|
52
|
+
```bash
|
|
53
|
+
npm run build
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Elérhető Parancsok
|
|
57
|
+
|
|
58
|
+
- `npm run dev` - Fejlesztési szerver indítása
|
|
59
|
+
- `npm run build` - Gyártási build készítése
|
|
60
|
+
- `npm run preview` - Build előnézetének megtekintése
|
|
61
|
+
- `npm run lint` - ESLint futtatása
|
|
62
|
+
|
|
63
|
+
## Projekt Struktúra
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
src/
|
|
67
|
+
├── components/
|
|
68
|
+
│ ├── TelefonForm.jsx # Telefon felvételi form
|
|
69
|
+
│ ├── TelefonGrid.jsx # Telefonok grid nézete
|
|
70
|
+
│ └── TelefonEditModal.jsx # Telefon módosítási modal
|
|
71
|
+
├── services/
|
|
72
|
+
│ └── api.js # API hívások kezelése
|
|
73
|
+
├── App.jsx # Főkomponens
|
|
74
|
+
├── main.jsx # Belépési pont
|
|
75
|
+
└── index.css # Globális stílusok
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Konfiguráció
|
|
79
|
+
|
|
80
|
+
### .env fájl
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
VITE_API_BASE_URL=http://localhost:3000/api
|
|
84
|
+
VITE_API_TELEFONOK=/telefonok
|
|
85
|
+
VITE_API_GYARTOK=/gyartok
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Szükséges Backend Végpontok
|
|
89
|
+
|
|
90
|
+
Az alkalmazás az alábbi API végpontokat igényli:
|
|
91
|
+
|
|
92
|
+
**Telefonok:**
|
|
93
|
+
- `GET /api/telefonok` - Összes telefon listázása
|
|
94
|
+
- `POST /api/telefonok` - Új telefon felvétele
|
|
95
|
+
- `PATCH /api/telefonok/:id` - Telefon módosítása
|
|
96
|
+
- `DELETE /api/telefonok/:id` - Telefon törlése
|
|
97
|
+
|
|
98
|
+
**Gyártók:**
|
|
99
|
+
- `GET /api/gyartok` - Összes gyártó listázása
|
|
100
|
+
|
|
101
|
+
## Technológiák
|
|
102
|
+
|
|
103
|
+
- **React 18** - UI framework
|
|
104
|
+
- **Vite** - Build tool
|
|
105
|
+
- **Formik** - Form kezelés
|
|
106
|
+
- **Bootstrap** - CSS framework
|
|
107
|
+
- **ESLint** - Kódminőség ellenőrzés
|
|
108
|
+
|
|
109
|
+
## Licensz
|
|
110
|
+
|
|
111
|
+
MIT
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import react from 'eslint-plugin-react'
|
|
4
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
5
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{ ignores: ['dist'] },
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.{js,jsx}'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
ecmaVersion: 2020,
|
|
13
|
+
globals: globals.browser,
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaVersion: 'latest',
|
|
16
|
+
ecmaFeatures: { jsx: true },
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
settings: { react: { version: '18.3' } },
|
|
21
|
+
plugins: {
|
|
22
|
+
react,
|
|
23
|
+
'react-hooks': reactHooks,
|
|
24
|
+
'react-refresh': reactRefresh,
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
...js.configs.recommended.rules,
|
|
28
|
+
...react.configs.recommended.rules,
|
|
29
|
+
...react.configs['jsx-runtime'].rules,
|
|
30
|
+
...reactHooks.configs.recommended.rules,
|
|
31
|
+
'react/jsx-no-target-blank': 'off',
|
|
32
|
+
'react/prop-types': 'off',
|
|
33
|
+
'react-refresh/only-export-components': [
|
|
34
|
+
'warn',
|
|
35
|
+
{ allowConstantExport: true },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
]
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + React</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sg-frontend-starter",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React Vite starter template",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/mrsoosgabor/frontend-starter.git"
|
|
9
|
+
},
|
|
10
|
+
"author": "Gabor Soos",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "vite",
|
|
14
|
+
"build": "vite build",
|
|
15
|
+
"lint": "eslint .",
|
|
16
|
+
"preview": "vite preview"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"bootstrap": "^5.3.8",
|
|
20
|
+
"formik": "^2.4.9",
|
|
21
|
+
"react": "^18.3.1",
|
|
22
|
+
"react-dom": "^18.3.1",
|
|
23
|
+
"reactstrap": "^9.2.3"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@eslint/js": "^9.17.0",
|
|
27
|
+
"@types/react": "^18.3.18",
|
|
28
|
+
"@types/react-dom": "^18.3.5",
|
|
29
|
+
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
30
|
+
"eslint": "^9.17.0",
|
|
31
|
+
"eslint-plugin-react": "^7.37.2",
|
|
32
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
33
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
34
|
+
"globals": "^15.14.0",
|
|
35
|
+
"vite": "^6.0.5"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/src/App.css
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* Form Container */
|
|
2
|
+
.form-container {
|
|
3
|
+
max-width: 500px !important;
|
|
4
|
+
width: 90% !important;
|
|
5
|
+
padding: 30px !important;
|
|
6
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
|
7
|
+
border-radius: 10px !important;
|
|
8
|
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
|
|
9
|
+
display: flex !important;
|
|
10
|
+
flex-direction: column !important;
|
|
11
|
+
align-items: stretch !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.form-container h2 {
|
|
15
|
+
color: white !important;
|
|
16
|
+
text-align: center !important;
|
|
17
|
+
margin-bottom: 30px !important;
|
|
18
|
+
font-size: 28px !important;
|
|
19
|
+
font-weight: 600 !important;
|
|
20
|
+
width: 100% !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Form */
|
|
24
|
+
.form-container form {
|
|
25
|
+
width: 100% !important;
|
|
26
|
+
display: flex !important;
|
|
27
|
+
flex-direction: column !important;
|
|
28
|
+
gap: 20px !important;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Form Fields */
|
|
32
|
+
.form-group {
|
|
33
|
+
width: 100% !important;
|
|
34
|
+
display: flex !important;
|
|
35
|
+
flex-direction: column !important;
|
|
36
|
+
margin-bottom: 0 !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.form-group label {
|
|
40
|
+
display: block !important;
|
|
41
|
+
margin-bottom: 8px !important;
|
|
42
|
+
color: white !important;
|
|
43
|
+
font-weight: 500 !important;
|
|
44
|
+
font-size: 14px !important;
|
|
45
|
+
letter-spacing: 0.5px !important;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.form-group input,
|
|
49
|
+
.form-group select {
|
|
50
|
+
width: 100% !important;
|
|
51
|
+
padding: 12px 15px !important;
|
|
52
|
+
border: 2px solid rgba(255, 255, 255, 0.3) !important;
|
|
53
|
+
border-radius: 6px !important;
|
|
54
|
+
font-size: 14px !important;
|
|
55
|
+
background-color: rgba(255, 255, 255, 0.95) !important;
|
|
56
|
+
transition: all 0.3s ease !important;
|
|
57
|
+
box-sizing: border-box !important;
|
|
58
|
+
color: #333 !important;
|
|
59
|
+
display: block !important;
|
|
60
|
+
margin: 0 !important;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.form-group input:focus,
|
|
64
|
+
.form-group select:focus {
|
|
65
|
+
outline: none;
|
|
66
|
+
border-color: white;
|
|
67
|
+
background-color: white;
|
|
68
|
+
box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.form-group select {
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
appearance: none;
|
|
74
|
+
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
|
|
75
|
+
background-repeat: no-repeat;
|
|
76
|
+
background-position: right 10px center;
|
|
77
|
+
background-size: 1.5em;
|
|
78
|
+
padding-right: 38px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Error Messages */
|
|
82
|
+
.form-group .error-message {
|
|
83
|
+
color: #ff6b6b !important;
|
|
84
|
+
font-size: 12px !important;
|
|
85
|
+
margin-top: 6px !important;
|
|
86
|
+
font-weight: 500 !important;
|
|
87
|
+
display: block !important;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Submit Button */
|
|
91
|
+
.form-group button {
|
|
92
|
+
width: 100% !important;
|
|
93
|
+
padding: 12px !important;
|
|
94
|
+
background-color: white !important;
|
|
95
|
+
color: #667eea !important;
|
|
96
|
+
border: none !important;
|
|
97
|
+
border-radius: 6px !important;
|
|
98
|
+
font-size: 16px !important;
|
|
99
|
+
font-weight: 600 !important;
|
|
100
|
+
cursor: pointer !important;
|
|
101
|
+
transition: all 0.3s ease !important;
|
|
102
|
+
margin-top: 10px !important;
|
|
103
|
+
letter-spacing: 1px !important;
|
|
104
|
+
text-transform: uppercase !important;
|
|
105
|
+
display: block !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.form-group button:hover:not(:disabled) {
|
|
109
|
+
background-color: #f0f0f0;
|
|
110
|
+
transform: translateY(-2px);
|
|
111
|
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.form-group button:disabled {
|
|
115
|
+
opacity: 0.6;
|
|
116
|
+
cursor: not-allowed;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.form-group button:active:not(:disabled) {
|
|
120
|
+
transform: translateY(0);
|
|
121
|
+
}
|
package/src/App.jsx
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import TelefonForm from "./components/TelefonForm";
|
|
3
|
+
import TelefonGrid from "./components/TelefonGrid";
|
|
4
|
+
import { tobb_oldalAPI, egy_oldalAPI } from "./services/api";
|
|
5
|
+
|
|
6
|
+
function App() {
|
|
7
|
+
const [gyartok, setGyartok] = useState([]);
|
|
8
|
+
const [mobilok, setMobilok] = useState([]);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
loadData();
|
|
12
|
+
}, []);
|
|
13
|
+
|
|
14
|
+
const loadData = async () => {
|
|
15
|
+
try {
|
|
16
|
+
const gyartokData = await egy_oldalAPI.getAll();
|
|
17
|
+
console.log("Gyártók:", gyartokData);
|
|
18
|
+
setGyartok(gyartokData);
|
|
19
|
+
|
|
20
|
+
const mobilokData = await tobb_oldalAPI.getAll();
|
|
21
|
+
console.log("Telefonok:", mobilokData);
|
|
22
|
+
setMobilok(mobilokData);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error("Hiba az adatok betöltése során:", error);
|
|
25
|
+
alert("Hiba történt az adatok betöltése során");
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const handleSubmit = async (obj) => {
|
|
30
|
+
try {
|
|
31
|
+
const data = await tobb_oldalAPI.create(obj);
|
|
32
|
+
console.log(data);
|
|
33
|
+
alert("Sikeres adatfelvétel");
|
|
34
|
+
|
|
35
|
+
// Újra betöltjük a telefonok listáját
|
|
36
|
+
const mobilokData = await tobb_oldalAPI.getAll();
|
|
37
|
+
setMobilok(mobilokData);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error("Hiba az adatfelvétel során:", error);
|
|
40
|
+
alert("Hiba történt az adatfelvétel során: " + error.message);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const handleUpdate = async (id, updateData) => {
|
|
45
|
+
try {
|
|
46
|
+
console.log("Módosítási kérés adatai:", updateData);
|
|
47
|
+
const data = await tobb_oldalAPI.update(id, updateData);
|
|
48
|
+
console.log(data);
|
|
49
|
+
alert("Telefon sikeresen módosítva");
|
|
50
|
+
|
|
51
|
+
// Frissítjük a listát
|
|
52
|
+
const mobilokData = await tobb_oldalAPI.getAll();
|
|
53
|
+
console.log("Telefonok:", mobilokData);
|
|
54
|
+
setMobilok(mobilokData);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error("Hiba a módosítás során:", error);
|
|
57
|
+
alert("Hiba történt a módosítás során: " + error.message);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handleDelete = async (id) => {
|
|
62
|
+
if (window.confirm("Biztosan törli ezt a telefont?")) {
|
|
63
|
+
try {
|
|
64
|
+
await tobb_oldalAPI.delete(id);
|
|
65
|
+
alert("Telefon sikeresen törölve");
|
|
66
|
+
|
|
67
|
+
// Frissítjük a listát
|
|
68
|
+
const mobilokData = await tobb_oldalAPI.getAll();
|
|
69
|
+
console.log("Telefonok:", mobilokData);
|
|
70
|
+
setMobilok(mobilokData);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error("Hiba a törlés során:", error);
|
|
73
|
+
alert("Hiba történt a törlés során: " + error.message);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
<TelefonForm gyartok={gyartok} onSubmit={handleSubmit} />
|
|
81
|
+
<TelefonGrid
|
|
82
|
+
mobilok={mobilok}
|
|
83
|
+
gyartok={gyartok}
|
|
84
|
+
onDelete={handleDelete}
|
|
85
|
+
onUpdate={handleUpdate}
|
|
86
|
+
/>
|
|
87
|
+
</>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default App
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
|
|
3
|
+
export default function TelefonEditModal({ isOpen, telefon, gyartok, onClose, onSave }) {
|
|
4
|
+
const [editingTelefon, setEditingTelefon] = useState(null);
|
|
5
|
+
|
|
6
|
+
// Frissítjük az editingTelefon state-et, amikor a telefon prop megváltozik
|
|
7
|
+
if (telefon && (!editingTelefon || editingTelefon._id !== telefon._id)) {
|
|
8
|
+
setEditingTelefon({ ...telefon });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const handleUpdate = async () => {
|
|
12
|
+
if (!editingTelefon._id || !editingTelefon.nev || !editingTelefon.ar) {
|
|
13
|
+
alert("Kérjük, töltse ki az összes mezőt");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const gyartIdValue = typeof editingTelefon.gyartId === 'object'
|
|
18
|
+
? editingTelefon.gyartId._id
|
|
19
|
+
: editingTelefon.gyartId;
|
|
20
|
+
|
|
21
|
+
if (!gyartIdValue) {
|
|
22
|
+
alert("Kérjük, válasszon egy gyártót");
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const updateData = {
|
|
27
|
+
nev: editingTelefon.nev,
|
|
28
|
+
ar: editingTelefon.ar,
|
|
29
|
+
gyartId: gyartIdValue
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
await onSave(editingTelefon._id, updateData);
|
|
33
|
+
handleClose();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const handleClose = () => {
|
|
37
|
+
setEditingTelefon(null);
|
|
38
|
+
onClose();
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
if (!isOpen || !editingTelefon) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className="modal d-block" style={{ backgroundColor: "rgba(0, 0, 0, 0.5)" }}>
|
|
47
|
+
<div className="modal-dialog modal-dialog-centered">
|
|
48
|
+
<div className="modal-content">
|
|
49
|
+
<div className="modal-header bg-primary text-white">
|
|
50
|
+
<h5 className="modal-title">Telefon módosítása</h5>
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
className="btn-close btn-close-white"
|
|
54
|
+
onClick={handleClose}
|
|
55
|
+
></button>
|
|
56
|
+
</div>
|
|
57
|
+
<div className="modal-body">
|
|
58
|
+
<div>
|
|
59
|
+
<div className="mb-3">
|
|
60
|
+
<label className="form-label">ID:</label>
|
|
61
|
+
<input
|
|
62
|
+
type="text"
|
|
63
|
+
className="form-control"
|
|
64
|
+
value={editingTelefon._id}
|
|
65
|
+
disabled
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
<div className="mb-3">
|
|
69
|
+
<label className="form-label">Telefon Neve:</label>
|
|
70
|
+
<input
|
|
71
|
+
type="text"
|
|
72
|
+
className="form-control"
|
|
73
|
+
value={editingTelefon.nev}
|
|
74
|
+
onChange={(e) => setEditingTelefon({...editingTelefon, nev: e.target.value})}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
<div className="mb-3">
|
|
78
|
+
<label className="form-label">Ár (Ft):</label>
|
|
79
|
+
<input
|
|
80
|
+
type="text"
|
|
81
|
+
className="form-control"
|
|
82
|
+
value={editingTelefon.ar}
|
|
83
|
+
onChange={(e) => setEditingTelefon({...editingTelefon, ar: e.target.value})}
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
<div className="mb-3">
|
|
87
|
+
<label className="form-label">Gyártó:</label>
|
|
88
|
+
<select
|
|
89
|
+
className="form-select"
|
|
90
|
+
value={editingTelefon.gyartId._id || editingTelefon.gyartId}
|
|
91
|
+
onChange={(e) => {
|
|
92
|
+
const selectedGyarto = gyartok.find(g => g._id === e.target.value);
|
|
93
|
+
setEditingTelefon({...editingTelefon, gyartId: selectedGyarto || e.target.value});
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<option value="">-- Válasszon gyártót --</option>
|
|
97
|
+
{gyartok.map((gyarto) => (
|
|
98
|
+
<option key={gyarto._id} value={gyarto._id}>{gyarto.nev}</option>
|
|
99
|
+
))}
|
|
100
|
+
</select>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
<div className="modal-footer">
|
|
105
|
+
<button
|
|
106
|
+
type="button"
|
|
107
|
+
className="btn btn-secondary"
|
|
108
|
+
onClick={handleClose}
|
|
109
|
+
>
|
|
110
|
+
Mégse
|
|
111
|
+
</button>
|
|
112
|
+
<button
|
|
113
|
+
type="button"
|
|
114
|
+
className="btn btn-primary"
|
|
115
|
+
onClick={handleUpdate}
|
|
116
|
+
>
|
|
117
|
+
Mentés
|
|
118
|
+
</button>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ErrorMessage, Field, Form, Formik } from "formik";
|
|
2
|
+
|
|
3
|
+
export default function TelefonForm({ gyartok, onSubmit }) {
|
|
4
|
+
return (
|
|
5
|
+
<div className="d-flex justify-content-center pt-5">
|
|
6
|
+
<div style={{ width: "100%", maxWidth: "500px", padding: "30px" }}>
|
|
7
|
+
<h2 className="text-center mb-4 text-white" style={{ backgroundColor: "#667eea", padding: "20px", borderRadius: "10px 10px 0 0" }}>Telefon Felvétel</h2>
|
|
8
|
+
<Formik
|
|
9
|
+
initialValues={{ _id: "", nev: "", ar: "", gyartId: "" }}
|
|
10
|
+
validate={(values) => {
|
|
11
|
+
const errors = {};
|
|
12
|
+
if (!values._id) {
|
|
13
|
+
errors._id = "Kötelező kitölteni";
|
|
14
|
+
}
|
|
15
|
+
if (!values.nev) {
|
|
16
|
+
errors.nev = "Kötelező kitölteni";
|
|
17
|
+
}
|
|
18
|
+
return errors;
|
|
19
|
+
}}
|
|
20
|
+
onSubmit={async (values, { setSubmitting, resetForm }) => {
|
|
21
|
+
console.log("Form data", values);
|
|
22
|
+
await onSubmit(values);
|
|
23
|
+
setSubmitting(false);
|
|
24
|
+
resetForm();
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
{({ isSubmitting }) => (
|
|
28
|
+
<Form className="p-4" style={{ backgroundColor: "#f8f9fa", borderRadius: "0 0 10px 10px", boxShadow: "0 10px 25px rgba(0, 0, 0, 0.1)" }}>
|
|
29
|
+
<div className="mb-3">
|
|
30
|
+
<label htmlFor="_id" className="form-label">ID: </label>
|
|
31
|
+
<Field type="text" name="_id" placeholder="Adjon meg egy egyedi ID-t" className="form-control" />
|
|
32
|
+
<ErrorMessage name="_id" component="div" className="text-danger mt-2" />
|
|
33
|
+
</div>
|
|
34
|
+
<div className="mb-3">
|
|
35
|
+
<label htmlFor="nev" className="form-label">Telefon Neve: </label>
|
|
36
|
+
<Field type="text" name="nev" placeholder="pl. iPhone 15 Pro" className="form-control" />
|
|
37
|
+
<ErrorMessage name="nev" component="div" className="text-danger mt-2" />
|
|
38
|
+
</div>
|
|
39
|
+
<div className="mb-3">
|
|
40
|
+
<label htmlFor="ar" className="form-label">Ár (Ft): </label>
|
|
41
|
+
<Field type="text" name="ar" placeholder="pl. 500000" className="form-control" />
|
|
42
|
+
<ErrorMessage name="ar" component="div" className="text-danger mt-2" />
|
|
43
|
+
</div>
|
|
44
|
+
<div className="mb-3">
|
|
45
|
+
<label htmlFor="gyartId" className="form-label">Gyártó: </label>
|
|
46
|
+
<Field name="gyartId" as="select" className="form-select">
|
|
47
|
+
<option value="">-- Válasszon gyártót --</option>
|
|
48
|
+
{gyartok.map((gyarto) => (
|
|
49
|
+
<option key={gyarto._id} value={gyarto._id}>{gyarto.nev}</option>
|
|
50
|
+
))}
|
|
51
|
+
</Field>
|
|
52
|
+
<ErrorMessage name="gyartId" component="div" className="text-danger mt-2" />
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<button type="submit" disabled={isSubmitting} className="btn btn-primary w-100 fw-bold">
|
|
56
|
+
{isSubmitting ? "Feldolgozás..." : "Hozzáadás"}
|
|
57
|
+
</button>
|
|
58
|
+
</Form>
|
|
59
|
+
)}
|
|
60
|
+
</Formik>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import TelefonEditModal from "./TelefonEditModal";
|
|
3
|
+
|
|
4
|
+
export default function TelefonGrid({ mobilok, gyartok, onDelete, onUpdate }) {
|
|
5
|
+
const [editingTelefon, setEditingTelefon] = useState(null);
|
|
6
|
+
const [showModal, setShowModal] = useState(false);
|
|
7
|
+
|
|
8
|
+
const openEditModal = (telefon) => {
|
|
9
|
+
setEditingTelefon({ ...telefon });
|
|
10
|
+
setShowModal(true);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const closeModal = () => {
|
|
14
|
+
setShowModal(false);
|
|
15
|
+
setEditingTelefon(null);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const handleUpdate = async (id, updateData) => {
|
|
19
|
+
await onUpdate(id, updateData);
|
|
20
|
+
closeModal();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<div className="container mt-5 mb-5">
|
|
26
|
+
<h2 className="mb-4">Telefonok Listája</h2>
|
|
27
|
+
<div className="row g-4">
|
|
28
|
+
{mobilok && mobilok.length > 0 ? (
|
|
29
|
+
mobilok.map((telefon) => {
|
|
30
|
+
return (
|
|
31
|
+
<div key={telefon._id} className="col-md-4 col-sm-6 col-12">
|
|
32
|
+
<div className="card h-100 shadow-sm" style={{ borderTop: "4px solid #667eea" }}>
|
|
33
|
+
<div className="card-body">
|
|
34
|
+
<h5 className="card-title text-primary">{telefon.nev}</h5>
|
|
35
|
+
<p className="card-text mb-2">
|
|
36
|
+
<strong>ID:</strong> {telefon._id}
|
|
37
|
+
</p>
|
|
38
|
+
<p className="card-text mb-2">
|
|
39
|
+
<strong>Ár:</strong> <span className="text-success fw-bold">{telefon.ar} Ft</span>
|
|
40
|
+
</p>
|
|
41
|
+
<p className="card-text mb-0">
|
|
42
|
+
<strong>Gyártó:</strong> {telefon.gyartId ? telefon.gyartId.nev : "Ismeretlen"}
|
|
43
|
+
</p>
|
|
44
|
+
<div className="d-flex gap-2 mt-3">
|
|
45
|
+
<button
|
|
46
|
+
className="btn btn-warning btn-sm flex-grow-1"
|
|
47
|
+
onClick={() => openEditModal(telefon)}
|
|
48
|
+
>
|
|
49
|
+
Módosítás
|
|
50
|
+
</button>
|
|
51
|
+
<button
|
|
52
|
+
className="btn btn-danger btn-sm flex-grow-1"
|
|
53
|
+
onClick={() => onDelete(telefon._id)}
|
|
54
|
+
>
|
|
55
|
+
Törlés
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
})
|
|
63
|
+
) : (
|
|
64
|
+
<div className="col-12">
|
|
65
|
+
<div className="alert alert-info text-center">Nincsenek telefonok az adatbázisban</div>
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<TelefonEditModal
|
|
72
|
+
isOpen={showModal}
|
|
73
|
+
telefon={editingTelefon}
|
|
74
|
+
gyartok={gyartok}
|
|
75
|
+
onClose={closeModal}
|
|
76
|
+
onSave={handleUpdate}
|
|
77
|
+
/>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|
package/src/index.css
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
* {
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
box-sizing: border-box !important;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
html, body, #root {
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
14
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
15
|
+
sans-serif;
|
|
16
|
+
-webkit-font-smoothing: antialiased;
|
|
17
|
+
-moz-osx-font-smoothing: grayscale;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#root {
|
|
21
|
+
display: flex !important;
|
|
22
|
+
flex-direction: column !important;
|
|
23
|
+
align-items: center !important;
|
|
24
|
+
justify-content: flex-start !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
div[class*="container text-center"] {
|
|
28
|
+
display: none !important;
|
|
29
|
+
}
|
package/src/main.jsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StrictMode } from 'react'
|
|
2
|
+
import { createRoot } from 'react-dom/client'
|
|
3
|
+
import './index.css'
|
|
4
|
+
import App from './App.jsx'
|
|
5
|
+
import "bootstrap/dist/css/bootstrap.min.css";
|
|
6
|
+
|
|
7
|
+
createRoot(document.getElementById('root')).render(
|
|
8
|
+
<StrictMode>
|
|
9
|
+
<App />
|
|
10
|
+
</StrictMode>,
|
|
11
|
+
)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
|
|
2
|
+
const ENDPOINTS = {
|
|
3
|
+
TOBB_OLDAL: import.meta.env.VITE_API_TOBB_OLDAL,
|
|
4
|
+
EGY_OLDAL: import.meta.env.VITE_API_EGY_OLDAL,
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Általános API hívás kezelő függvény
|
|
9
|
+
* @param {string} endpoint - Az API végpont (pl. '/telefonok', '/gyartok')
|
|
10
|
+
* @param {object} options - Fetch opciók (method, body, stb.)
|
|
11
|
+
* @returns {Promise} - A válasz JSON formátumban
|
|
12
|
+
*/
|
|
13
|
+
export async function apiCall(endpoint, options = {}) {
|
|
14
|
+
const { method = 'GET', body, headers = {} } = options;
|
|
15
|
+
|
|
16
|
+
const config = {
|
|
17
|
+
method,
|
|
18
|
+
headers: {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
...headers,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
if (body) {
|
|
25
|
+
config.body = JSON.stringify(body);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(`${API_BASE_URL}${endpoint}`, config);
|
|
30
|
+
|
|
31
|
+
const data = await response.json();
|
|
32
|
+
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
throw new Error(data.message || `HTTP error! status: ${response.status}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return data;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('API hívás hiba:', error);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Specifikus API hívások
|
|
45
|
+
export const tobb_oldalAPI = {
|
|
46
|
+
getAll: () => apiCall(ENDPOINTS.TOBB_OLDAL),
|
|
47
|
+
|
|
48
|
+
getById: (id) => apiCall(`${ENDPOINTS.TOBB_OLDAL}/${id}`),
|
|
49
|
+
|
|
50
|
+
create: (data) => apiCall(ENDPOINTS.TOBB_OLDAL, {
|
|
51
|
+
method: 'POST',
|
|
52
|
+
body: data,
|
|
53
|
+
}),
|
|
54
|
+
|
|
55
|
+
update: (id, data) => apiCall(`${ENDPOINTS.TOBB_OLDAL}/${id}`, {
|
|
56
|
+
method: 'PATCH',
|
|
57
|
+
body: data,
|
|
58
|
+
}),
|
|
59
|
+
|
|
60
|
+
delete: (id) => apiCall(`${ENDPOINTS.TOBB_OLDAL}/${id}`, {
|
|
61
|
+
method: 'DELETE',
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const egy_oldalAPI = {
|
|
66
|
+
getAll: () => apiCall(ENDPOINTS.EGY_OLDAL),
|
|
67
|
+
|
|
68
|
+
getById: (id) => apiCall(`${ENDPOINTS.EGY_OLDAL}/${id}`),
|
|
69
|
+
|
|
70
|
+
create: (data) => apiCall(ENDPOINTS.EGY_OLDAL, {
|
|
71
|
+
method: 'POST',
|
|
72
|
+
body: data,
|
|
73
|
+
}),
|
|
74
|
+
|
|
75
|
+
update: (id, data) => apiCall(`${ENDPOINTS.EGY_OLDAL}/${id}`, {
|
|
76
|
+
method: 'PATCH',
|
|
77
|
+
body: data,
|
|
78
|
+
}),
|
|
79
|
+
|
|
80
|
+
delete: (id) => apiCall(`${ENDPOINTS.EGY_OLDAL}/${id}`, {
|
|
81
|
+
method: 'DELETE',
|
|
82
|
+
}),
|
|
83
|
+
};
|
package/vite.config.js
ADDED