您最多选择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. };