Refactor file download logic to improve authentication handling and code readability
This commit is contained in:
@@ -336,7 +336,8 @@ class _FileExplorerState extends State<FileExplorer> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Build full URL with token for authentication (anchor elements can't send headers)
|
// Build full URL with token for authentication (anchor elements can't send headers)
|
||||||
final fullUrl = '${fileService.baseUrl}$downloadUrl&token=${Uri.encodeComponent(token)}';
|
final fullUrl =
|
||||||
|
'${fileService.baseUrl}$downloadUrl&token=${Uri.encodeComponent(token)}';
|
||||||
|
|
||||||
// Trigger download via anchor element
|
// Trigger download via anchor element
|
||||||
final anchor = web.HTMLAnchorElement()
|
final anchor = web.HTMLAnchorElement()
|
||||||
@@ -351,7 +352,11 @@ class _FileExplorerState extends State<FileExplorer> {
|
|||||||
SnackBar(
|
SnackBar(
|
||||||
content: Row(
|
content: Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.download_done, color: AppTheme.accentColor, size: 20),
|
const Icon(
|
||||||
|
Icons.download_done,
|
||||||
|
color: AppTheme.accentColor,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|||||||
Reference in New Issue
Block a user