您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

getOrdersForOwnerRequest.ts 471B

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