Skip to content

Commit

Permalink
Merge pull request #15 from inblockio/db_fixes
Browse files Browse the repository at this point in the history
fix ui problem
  • Loading branch information
Arthur-Kamau authored Dec 16, 2024
2 parents 606e753 + b69ecc7 commit c77c58a
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions web/src/pages/SharePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import ChainDetails from '../components/ui/navigation/CustomDrawer'
import FilePreview from '../components/FilePreview'
import ConnectWallet from '../components/ui/navigation/ConnectWallet'
import { ImportAquaChainFromChain } from '../components/dropzone_file_actions'
import { Alert } from '../components/ui/alert'

const SharePage = () => {
const { backend_url, metamaskAddress } = useStore(appStore)
const [fileInfo, setFileInfo] = useState<ApiFileInfo | null>(null)
const [loading, setLoading] = useState(false)
const [hasError, setHasError] = useState<string | null>(null);
const [isVerificationSuccesful, setIsVerificationSuccessful] = useState(false)

const params = useParams()
Expand All @@ -40,11 +42,19 @@ const SharePage = () => {
setLoading(false)
}
catch (error: any) {
console.error(error)
if (error.response.status == 404){
setHasError(`File could not be found (probably it was deleted)`);
}else{
setHasError(`Error : ${error}`);
}
console.error(error) ;



toaster.create({
description: `Error fetching data`,
type: 'error'
})
});
}
}
}
Expand All @@ -64,12 +74,25 @@ const SharePage = () => {
// }
}, [])

const showProperWidget = () => {
if (hasError) {
return <Center>
<Alert status="error" title="An error occured">
{hasError}
</Alert>
</Center>
}
if (loading) {
return <Center>
<Loading type='spin' width={'80px'} />
</Center>
}
return <div />
}
return (
<div>
{
loading ? <Center>
<Loading type='spin' width={'80px'} />
</Center> : null
showProperWidget()
}
{
fileInfo ? (
Expand Down

0 comments on commit c77c58a

Please sign in to comment.