Update project files

This commit is contained in:
2026-07-17 09:48:48 +01:00
parent 63e5871e61
commit c6023d8d7b
29 changed files with 1309 additions and 718 deletions

View File

@@ -27,11 +27,11 @@ This app is no longer a static demo. It now uses the backend API for authenticat
| `/barcode` | Scan a barcode and search the inventory API for matches. |
| `/users` | Site-admin users page scaffold for loading all users once the backend endpoint is available. |
Routing is defined in `src/App.jsx`.
Routing is defined in `src/App.tsx`.
## API Endpoint Map
### Dashboard (`src/pages/HomePage/HomePage.jsx`)
### Dashboard (`src/pages/HomePage/HomePage.tsx`)
When signed out:
@@ -42,7 +42,7 @@ When signed in:
- `GET /api/locations`
- `GET /api/inventoryitems`
### Inventory (`src/pages/InventoryPage/InventoryPage.jsx`)
### Inventory (`src/pages/InventoryPage/InventoryPage.tsx`)
Locations:
@@ -59,7 +59,7 @@ Inventory items:
- `PUT /api/inventoryitems/{id}`
- `DELETE /api/inventoryitems/{id}`
### Admin (`src/pages/AdminPage/AdminPage.jsx`)
### Admin (`src/pages/AdminPage/AdminPage.tsx`)
Households:
@@ -79,7 +79,7 @@ Notes:
- User creation on this page uses the register contract: `email`, `password`, `confirmPassword`, `firstName`, and `lastName`.
- The register endpoint does not assign roles, so new users are created without admin access by default.
### Search (`src/pages/SearchPage/SearchPage.jsx`)
### Search (`src/pages/SearchPage/SearchPage.tsx`)
Initial page data:
@@ -96,13 +96,13 @@ Note:
- The backend search API only supports the `q` query parameter.
- Location, amount, expiry-date filtering, and pagination are applied client-side after the API search returns.
### Barcode (`src/pages/BarcodePage/BarcodePage.jsx`)
### Barcode (`src/pages/BarcodePage/BarcodePage.tsx`)
- `GET /api/search/items?q={barcode}`
The barcode page scans via Quagga2, then searches the backend for inventory items whose barcode or other searchable fields match the scanned value.
### Users (`src/pages/UsersPage/UsersPage.jsx`)
### Users (`src/pages/UsersPage/UsersPage.tsx`)
- `GET /api/users`
@@ -111,7 +111,7 @@ Notes:
- The users page is intentionally minimal and is ready to consume a future users endpoint.
- The current C# repo does not expose `GET /api/users` yet, so the page shows a placeholder when that endpoint returns `404`.
### Shared Auth Support (`src/api/client.js`)
### Shared Auth Support (`src/api/client.ts`)
The shared API client also supports:
@@ -124,7 +124,7 @@ Notes:
## API Configuration
The API base URL is configured in `src/api/client.js`.
The API base URL is configured in `src/api/client.ts`.
Current setup:
@@ -157,8 +157,8 @@ After changing the env file, restart the Vite dev server.
Auth/session logic lives in:
- `src/api/client.js`
- `src/context/AuthContext.jsx`
- `src/api/client.ts`
- `src/context/AuthContext.tsx`
Behavior:
@@ -268,15 +268,15 @@ Use `/users` to:
| File | Purpose |
| --- | --- |
| `src/api/client.js` | API base URL, fetch wrapper, auth headers, token refresh, endpoint helpers |
| `src/context/AuthContext.jsx` | Shared auth/session state for the React app |
| `src/App.jsx` | Route definitions |
| `src/pages/AdminPage/AdminPage.jsx` | Household administration UI |
| `src/pages/HomePage/HomePage.jsx` | Dashboard and login UI |
| `src/pages/InventoryPage/InventoryPage.jsx` | Location and inventory CRUD UI |
| `src/pages/SearchPage/SearchPage.jsx` | API-backed search UI |
| `src/pages/BarcodePage/BarcodePage.jsx` | Barcode scanning and API lookup UI |
| `src/pages/UsersPage/UsersPage.jsx` | Users endpoint scaffold and list view |
| `src/api/client.ts` | API base URL, fetch wrapper, auth headers, token refresh, endpoint helpers |
| `src/context/AuthContext.tsx` | Shared auth/session state for the React app |
| `src/App.tsx` | Route definitions |
| `src/pages/AdminPage/AdminPage.tsx` | Household administration UI |
| `src/pages/HomePage/HomePage.tsx` | Dashboard and login UI |
| `src/pages/InventoryPage/InventoryPage.tsx` | Location and inventory CRUD UI |
| `src/pages/SearchPage/SearchPage.tsx` | API-backed search UI |
| `src/pages/BarcodePage/BarcodePage.tsx` | Barcode scanning and API lookup UI |
| `src/pages/UsersPage/UsersPage.tsx` | Users endpoint scaffold and list view |
## Troubleshooting