order page: integration
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import {
|
||||
CREATE_ORDER_URL,
|
||||
ORDERS_URL,
|
||||
PRODUCTS_AND_CATEGORIES_URL,
|
||||
RESTAURANT_DETAILS_URL,
|
||||
CREATE_ORDER_URL,
|
||||
ORDER_DETAILS_URL,
|
||||
ORDERS_URL,
|
||||
PRODUCTS_AND_CATEGORIES_URL,
|
||||
RESTAURANT_DETAILS_URL,
|
||||
TABLES_URL,
|
||||
} from "utils/constants";
|
||||
|
||||
import { OrderDetails } from "pages/checkout/hooks/types";
|
||||
import menuParser from "pages/menu/helper";
|
||||
import { RestaurantDetails } from "utils/types/appTypes";
|
||||
import { baseApi } from "./apiSlice";
|
||||
@@ -43,6 +46,40 @@ export const branchApi = baseApi.injectEndpoints({
|
||||
}),
|
||||
invalidatesTags: ["Orders"],
|
||||
}),
|
||||
getTables: builder.query<
|
||||
any,
|
||||
{ restaurantID: string; tableType: string }
|
||||
>({
|
||||
query: ({
|
||||
restaurantID,
|
||||
tableType,
|
||||
}: {
|
||||
restaurantID: string;
|
||||
tableType: string;
|
||||
}) => ({
|
||||
url: TABLES_URL,
|
||||
method: "POST",
|
||||
body: {
|
||||
restaurantID,
|
||||
tableType,
|
||||
},
|
||||
}),
|
||||
transformResponse: (response: any) => {
|
||||
return response.result.data;
|
||||
},
|
||||
}),
|
||||
getOrderDetails: builder.query<OrderDetails, { orderID: string; restaurantID: string }>({
|
||||
query: ({ orderID, restaurantID }: { orderID: string; restaurantID: string }) => ({
|
||||
url: `${ORDER_DETAILS_URL}/${orderID}`,
|
||||
method: "POST",
|
||||
body: {
|
||||
restaurantID,
|
||||
},
|
||||
}),
|
||||
transformResponse: (response: any) => {
|
||||
return response.result;
|
||||
},
|
||||
}),
|
||||
}),
|
||||
});
|
||||
export const {
|
||||
@@ -50,4 +87,6 @@ export const {
|
||||
useGetMenuQuery,
|
||||
useCreateOrderMutation,
|
||||
useGetOrdersQuery,
|
||||
useGetTablesQuery,
|
||||
useGetOrderDetailsQuery,
|
||||
} = branchApi;
|
||||
|
||||
Reference in New Issue
Block a user