Fix document viewer: add dynamic base URL and debug logging for file downloads
This commit is contained in:
@@ -169,9 +169,16 @@ class _DocumentViewerModalState extends State<DocumentViewerModal> {
|
||||
}
|
||||
if (state is DocumentViewerReady) {
|
||||
if (state.caps.isPdf) {
|
||||
// Log the URL being used for debugging
|
||||
print('Loading PDF from: ${state.viewUrl}');
|
||||
print('Using token: ${state.token.substring(0, 20)}...');
|
||||
return SfPdfViewer.network(
|
||||
state.viewUrl.toString(),
|
||||
headers: {'Authorization': 'Bearer ${state.token}'},
|
||||
onDocumentLoadFailed: (details) {
|
||||
print('PDF load failed: ${details.error}');
|
||||
print('Description: ${details.description}');
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
|
||||
Reference in New Issue
Block a user