Fix and cleanup for Events.WebApi

This commit is contained in:
Boris Milašinović
2026-05-11 23:49:25 +02:00
parent 4fb3de19f6
commit b66d05c298
22 changed files with 572 additions and 113 deletions

View File

@@ -1,6 +1,6 @@
# Events.ClientApp
`Events.ClientApp` is the Vue 3 front-end for Topic 2.
`Events.ClientApp` is the Vue 3 front-end for the `Events-WebApi` solution.
It uses:
@@ -9,7 +9,10 @@ It uses:
- PrimeVue
- Auth0 Vue SDK
It is intended as a companion UI for the `Events.WebAPI` backend and demonstrates how the secured API can be consumed from a browser application.
It is intended as a companion UI for:
- `Events.WebAPI` for CRUD and lookup operations
- `Events.FilesAPI` for certificate and Excel downloads
## Scripts
@@ -59,7 +62,7 @@ The simplest setup is to copy `.env.example` to `.env.local` and fill in the rea
Example:
```powershell
Copy-Item Topic2\Events.ClientApp\.env.example Topic2\Events.ClientApp\.env.local
Copy-Item .env.example .env.local
```
## Environment Variables
@@ -83,12 +86,19 @@ Copy-Item Topic2\Events.ClientApp\.env.example Topic2\Events.ClientApp\.env.loca
### API configuration
- `VITE_API_BASE_URL`
Base URL of the Web API
Base URL of `Events.WebAPI`
- `VITE_FILES_API_BASE_URL`
Base URL of `Events.FilesAPI`
If `VITE_API_BASE_URL` is not set, the app falls back to:
- `https://localhost:7150`
If `VITE_FILES_API_BASE_URL` is not set, the app falls back to:
- `https://localhost:7296`
## Example
```env
@@ -96,18 +106,21 @@ VITE_AUTH0_DOMAIN=fer-web2.eu.auth0.com
VITE_AUTH0_CLIENT_ID=whed5Hdb8l1b1fGyyAz7Qrdsb2oKcSh3
VITE_AUTH0_AUDIENCE=https://erasmus-sta-2026/events-api
VITE_AUTH0_SCOPE=openid profile email events:read events:write
VITE_API_BASE_URL=https://localhost:7150
VITE_API_BASE_URL=https://localhost:7295
VITE_FILES_API_BASE_URL=https://localhost:7296
```
## Notes
- `VITE_AUTH0_DOMAIN` and `VITE_AUTH0_CLIENT_ID` are required if you want the Auth0 login flow to work.
- `VITE_AUTH0_AUDIENCE` and `VITE_AUTH0_SCOPE` are optional in code, but usually needed if the API expects bearer tokens with a specific audience and scopes.
- `VITE_AUTH0_AUDIENCE` and `VITE_AUTH0_SCOPE` are optional in code, but are usually needed if the APIs expect bearer tokens with a specific audience and scopes.
- `VITE_API_BASE_URL` should point to the running `Events.WebAPI` instance for local development.
- `VITE_FILES_API_BASE_URL` should point to the running `Events.FilesAPI` instance for local development.
- `.env.local` is for local development and should not be treated as a shared secrets file.
## What The Client Demonstrates
- login and token acquisition through Auth0
- calling the secured Topic 2 API
- local development against a separately running ASP.NET Core backend
- calling secured `Events.WebAPI` endpoints
- downloading protected files from `Events.FilesAPI`
- local development against separately running ASP.NET Core backends