mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
change api
This commit is contained in:
@@ -58,22 +58,19 @@ export default function App() {
|
||||
window.location.reload()
|
||||
}
|
||||
|
||||
const _onGenerate = () => {
|
||||
const _onGenerate = async () => {
|
||||
setPdfIsLoading(true)
|
||||
setPdfError(null)
|
||||
|
||||
generatePdf(options)
|
||||
.then((data) => {
|
||||
const { id } = data
|
||||
|
||||
setPdfIsLoading(false)
|
||||
setPdfUrl(`/api/pdf/${id}`)
|
||||
})
|
||||
.catch((error) => {
|
||||
setPdfIsLoading(false)
|
||||
setPdfError(error.message)
|
||||
setPdfUrl(null)
|
||||
})
|
||||
try {
|
||||
const url = await generatePdf(options)
|
||||
setPdfIsLoading(false)
|
||||
setPdfUrl(url)
|
||||
} catch (error) {
|
||||
setPdfIsLoading(false)
|
||||
setPdfError(error.message)
|
||||
setPdfUrl(null)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user