Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718
  1. import { SPersonResponse } from '../utils/interface/personInterface';
  2. import apiEndpoints from './apiEndpoints';
  3. export const getSingleData = async (
  4. dataId: string
  5. ): Promise<SPersonResponse> => {
  6. const response = await fetch(
  7. `http://localhost:3000${apiEndpoints.singleData}${dataId}`
  8. );
  9. const data: SPersonResponse = await response.json();
  10. if (!response.ok) {
  11. throw new Error(data.message || 'Something went wrong!');
  12. }
  13. return data;
  14. };