Skip to content

Commit

Permalink
Merge pull request #40 from superneko160/refactor-usedatafetch
Browse files Browse the repository at this point in the history
refactor:setError(hooks/useDataFetch.ts)
  • Loading branch information
superneko160 authored Nov 24, 2024
2 parents b1a8374 + 7d69d6e commit ec3bcff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions htmlparser/src/hooks/useDataFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import { isDownloadFileUrl, downloadFile } from '../utils/downloadFile'

export const useDataFetch = (formData: IndexFormData): UseDataFetchResult => {
const [data, setData] = useState<SuccessApiResponse | null>(null)
const [error, setError] = useState<string | null>(null)
const [error, setError] = useState<string>('')
const [isLoading, setIsLoading] = useState<boolean>(true)

useEffect(() => {
const fetchAndSetData = async () => {
setIsLoading(true)
setError(null)
setError('')

try {
const result = await fetchData(formData)
Expand Down

0 comments on commit ec3bcff

Please sign in to comment.