選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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. };