import { GetOrder } from "../../models/api";

import { api } from "./api";
import { extractBodyFromResponse, extractErrorMessageFromResponse } from "./utils";

export const landingApi = api.injectEndpoints({
  endpoints: ({ query }) => ({
    getOrder: query<GetOrder.Response, GetOrder.Params>({
      query: ({ orderId }) => `/order/${orderId}`,
      transformResponse: extractBodyFromResponse<GetOrder.Response>,
      transformErrorResponse: extractErrorMessageFromResponse,
    })
  })
});
