Skip to content

Commit

Permalink
useHook
Browse files Browse the repository at this point in the history
Signed-off-by: Deggen <[email protected]>
  • Loading branch information
sirdeggen committed Feb 21, 2025
1 parent 0832a97 commit 83de6b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions front/src/Upload.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { useState, useCallback } from 'react'
import { useFunding } from './useFunding'

const API_URL = import.meta.env?.VITE_API_URL || 'http://localhost:3030'

function Upload({ setMutate }: { readonly setMutate: React.Dispatch<React.SetStateAction<number>> }) {
function Upload() {
const [selectedFile, setSelectedFile] = useState<File | null>(null)
const [response, setResponse] = useState({ txid: '', network: '' })
const [loading, setLoading] = useState(false)
const { getFundingInfo } = useFunding()

const handleDrag = useCallback((e: React.DragEvent<HTMLElement>) => {
e.preventDefault()
Expand Down Expand Up @@ -44,7 +46,7 @@ function Upload({ setMutate }: { readonly setMutate: React.Dispatch<React.SetSta
console.error('Upload error:', error)
} finally {
setLoading(false)
setMutate((x: number) => x++)
getFundingInfo()
}
}
}, [selectedFile])
Expand Down

0 comments on commit 83de6b0

Please sign in to comment.