forked from VinokurovVE/tests
Add Document API calls
This commit is contained in:
27
frontend_reactjs/src/pages/Documents.tsx
Normal file
27
frontend_reactjs/src/pages/Documents.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import DocumentService from '../services/DocumentService'
|
||||
import { Box, Button } from '@mui/material'
|
||||
|
||||
export default function Documents() {
|
||||
const [data, setData] = useState()
|
||||
|
||||
const fetchData = async () => {
|
||||
await DocumentService.getDocuments().then(response => {
|
||||
setData(response.data)
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Button onClick={() => {
|
||||
fetchData()
|
||||
}}>
|
||||
Get data
|
||||
</Button>
|
||||
|
||||
<Box>
|
||||
{JSON.stringify(data)}
|
||||
</Box>
|
||||
</div>
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user