feat(frontend) : admin middleware, fix avatar upload, centralize IRI extraction, remove Nitro proxy
- Add admin middleware protecting /admin page (ROLE_ADMIN check) - Fix useAvatarService to use useApi() with FormData detection - Create extractIdFromIri() utility, replace manual IRI parsing - Remove redundant Nitro devProxy (Vite proxy handles dev) Tickets: T-014, T-015, T-017, T-021 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
11
frontend/utils/iri.ts
Normal file
11
frontend/utils/iri.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Extract the numeric ID from an API Platform IRI string.
|
||||
* Example: "/api/projects/5" → 5
|
||||
*/
|
||||
export function extractIdFromIri(iri: string | null | undefined): number {
|
||||
if (!iri) return 0
|
||||
const lastSlash = iri.lastIndexOf('/')
|
||||
if (lastSlash === -1) return 0
|
||||
const id = Number(iri.substring(lastSlash + 1))
|
||||
return Number.isFinite(id) ? id : 0
|
||||
}
|
||||
Reference in New Issue
Block a user