| import apiEndpoints from './apiEndpoints'; | import apiEndpoints from './apiEndpoints'; | ||||
| export const getDataIds = async () => { | export const getDataIds = async () => { | ||||
| const response = await fetch(`http://localhost:3000/${apiEndpoints.dataIds}`); | |||||
| const response = await fetch(`http://localhost:3000${apiEndpoints.dataIds}`); | |||||
| const data = await response.json(); | const data = await response.json(); | ||||
| export const getData = async (pageIndex) => { | export const getData = async (pageIndex) => { | ||||
| const response = await fetch( | const response = await fetch( | ||||
| `http://localhost:3000/${apiEndpoints.data}?page=${pageIndex}` | |||||
| `http://localhost:3000${apiEndpoints.data}?page=${pageIndex}` | |||||
| ); | ); | ||||
| const data = await response.json(); | const data = await response.json(); |
| export const getSingleData = async (dataId) => { | export const getSingleData = async (dataId) => { | ||||
| const response = await fetch( | const response = await fetch( | ||||
| `http://localhost:3000/${apiEndpoints.singleData}${dataId}` | |||||
| `http://localhost:3000${apiEndpoints.singleData}${dataId}` | |||||
| ); | ); | ||||
| const data = await response.json(); | const data = await response.json(); |