-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d20249
commit 3ae5cd1
Showing
9 changed files
with
258 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { useState } from 'react'; | ||
import { Document, Page } from 'react-pdf'; | ||
import axios from '../../utils/axiosInstance'; | ||
|
||
const BookView = () => { | ||
const [numPages, setNumPages] = useState(null); | ||
const [pageNumber, setPageNumber] = useState(1); | ||
const [file,setFile] = useState(null); | ||
|
||
const getBook = async()=>{ | ||
const data = { | ||
ipfsLink:"https://ipfs.moralis.io:2053/ipfs/Qmb7axp3nYTctZjpiLX1wkXdoaHXu7iNQAVZdQuJNoHXj5/uploads/sample.pdf" | ||
} | ||
const res = await axios.post('book/get',data) | ||
// setFile(res.data) | ||
setFile(res.data.buffer.data) | ||
console.log(res) | ||
} | ||
|
||
function onDocumentLoadSuccess({ numPages }) { | ||
setNumPages(numPages); | ||
} | ||
return ( | ||
<> | ||
<Document file={""} onLoadSuccess={onDocumentLoadSuccess}> | ||
<Page pageNumber={pageNumber} /> | ||
</Document> | ||
<p> | ||
Page {pageNumber} of {numPages} | ||
</p> | ||
<button onClick={()=>getBook()}>Load</button> | ||
|
||
</> | ||
) | ||
} | ||
|
||
export default BookView |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.