chore: update API configuration and enhance authentication handling

- Updated Vite configuration to use the production API endpoint.
- Modified TypeScript build info to include new config file.
- Refactored API client to support authenticated URLs.
- Updated various components to utilize the new authenticated API URL for media fetching.
- Removed obsolete CSS and JS files from the distribution directory.
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-06-24 18:12:41 +03:00
parent da0a5aa187
commit 27351e83d2
17 changed files with 216 additions and 191 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
import { useRef, useEffect, useState, useCallback, forwardRef, useImperativeHandle } from 'react'
import { MediaType } from '../../types'
import type { Media, AnnotationListItem, Detection, Affiliation, CombatReadiness } from '../../types'
import { authenticatedApiUrl } from '../../api/client'
import { getClassColor, getPhotoModeSuffix, getClassNameFallback } from './classColors'
interface Props {
@@ -76,11 +77,11 @@ const CanvasEditor = forwardRef<CanvasEditorHandle, Props>(function CanvasEditor
const img = new Image()
img.crossOrigin = 'anonymous'
if (annotation && !media.path.startsWith('blob:')) {
img.src = `/api/annotations/annotations/${annotation.id}/image`
img.src = authenticatedApiUrl(`/api/annotations/annotations/${annotation.id}/image`)
} else if (media.path.startsWith('blob:')) {
img.src = media.path
} else {
img.src = `/api/annotations/media/${media.id}/file`
img.src = authenticatedApiUrl(`/api/annotations/media/${media.id}/file`)
}
img.onload = () => {
imgRef.current = img