Merge pull request #767 from Tria-plc/freight_feature/usermanagement

Freight feature/usermanagement
This commit is contained in:
marshal
2026-07-17 14:40:59 +03:00
committed by GitHub
37 changed files with 736 additions and 365 deletions

View File

@@ -24,3 +24,20 @@ export async function downloadBookingFile(
a.click();
URL.revokeObjectURL(url);
}
/**
* GET /files/:id is authenticated (global JwtGuard) — raw browser loads
* (<img>/<iframe>/<a href>) carry no Bearer token and 401. Fetch the bytes
* through the axios client and hand the viewer a blob object URL instead.
*/
export async function fetchViewableFile(
id: string,
name: string,
): Promise<{ name: string; url: string; mimeType?: string }> {
const blob = await filesService.download(id);
return {
name,
url: URL.createObjectURL(blob),
mimeType: blob.type || undefined,
};
}