You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dataIdsRequest.ts 430B

1234567891011121314
  1. import { PersonIdsResponse } from '../utils/interface/personInterface';
  2. import apiEndpoints from './apiEndpoints';
  3. export const getDataIds = async (): Promise<PersonIdsResponse> => {
  4. const response = await fetch(`http://localhost:3000${apiEndpoints.dataIds}`);
  5. const data: PersonIdsResponse = await response.json();
  6. if (!response.ok) {
  7. throw new Error(data.message || 'Something went wrong!');
  8. }
  9. return data;
  10. };