add error message for unsupported file
This commit is contained in:
@@ -70,7 +70,11 @@ export function FileSearchPanel(
|
||||
try {
|
||||
let result = await searchUserFiles(fileId);
|
||||
|
||||
if (result.content.length) {
|
||||
if (result.errorMessage) {
|
||||
throw result.errorMessage
|
||||
}
|
||||
|
||||
if (result?.content?.length) {
|
||||
setSearchedUserFiles(result.content);
|
||||
if (fileType === 'image') {
|
||||
setShowGlobalSearch(true);
|
||||
@@ -80,7 +84,12 @@ export function FileSearchPanel(
|
||||
setSearchedUserFilesShowNull(true);
|
||||
}
|
||||
} catch (error) {
|
||||
setErrorMessage('error');
|
||||
|
||||
if (error === 'file-for-search-unsupported') {
|
||||
setErrorMessage(error);
|
||||
} else {
|
||||
setErrorMessage('search-error');
|
||||
}
|
||||
}
|
||||
|
||||
}, [fileId])
|
||||
@@ -138,7 +147,7 @@ export function FileSearchPanel(
|
||||
|
||||
{errorMessage && (
|
||||
<div className='mt-2 text-red-600 text-sm'>
|
||||
{t('search-error')}
|
||||
{t(errorMessage)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user