Skip to content

Commit

Permalink
Actually put error in console, as promised
Browse files Browse the repository at this point in the history
  • Loading branch information
Peeja committed Oct 9, 2024
1 parent 90748ce commit b23c301
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/components/Uploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
useUploader
} from '@w3ui/react'
import { gatewayHost } from '../components/services'
import { useState } from 'react'
import { useEffect, useState } from 'react'
import { RadioGroup } from '@headlessui/react'
import { H2 } from './Text'

Expand Down Expand Up @@ -62,14 +62,23 @@ export const Uploading = ({
</div>
)

export const Errored = ({ error }: { error: any }): JSX.Element => (
<div className='flex flex-col items-center'>
<h1>
⚠️ Error: failed to upload file: {error.message}
</h1>
<p>Check the browser console for details.</p>
</div>
)
export const Errored = ({ error }: { error: any }): JSX.Element => {
useEffect(() => {
if (error != null) {
// eslint-disable-next-line no-console
console.error('Uploader Error:', error)
}
}, [error])

return (
(<div className='flex flex-col items-center'>
<h1>
⚠️ Error: failed to upload file: {error.message}
</h1>
<p>Check the browser console for details.</p>
</div>)
);
}

interface DoneProps {
file?: File
Expand Down

0 comments on commit b23c301

Please sign in to comment.