apply coupon discount
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
CANCEL_ORDER_URL,
|
||||
CREATE_ORDER_URL,
|
||||
DISCOUNT_URL,
|
||||
ORDER_DETAILS_URL,
|
||||
ORDERS_URL,
|
||||
PRODUCTS_AND_CATEGORIES_URL,
|
||||
@@ -10,7 +11,7 @@ import {
|
||||
|
||||
import { OrderDetails } from "pages/checkout/hooks/types";
|
||||
import menuParser from "pages/menu/helper";
|
||||
import { RestaurantDetails } from "utils/types/appTypes";
|
||||
import { DiscountResultType, RestaurantDetails } from "utils/types/appTypes";
|
||||
import { baseApi } from "./apiSlice";
|
||||
|
||||
export const branchApi = baseApi.injectEndpoints({
|
||||
@@ -101,6 +102,24 @@ export const branchApi = baseApi.injectEndpoints({
|
||||
return response.result;
|
||||
},
|
||||
}),
|
||||
getDiscount: builder.mutation<
|
||||
DiscountResultType,
|
||||
{ discountCode: string; restaurantID: string }
|
||||
>({
|
||||
query: ({
|
||||
discountCode,
|
||||
restaurantID,
|
||||
}: {
|
||||
discountCode: string;
|
||||
restaurantID: string;
|
||||
}) => ({
|
||||
url: `${DISCOUNT_URL}/${discountCode}/${restaurantID}`,
|
||||
method: "GET",
|
||||
}),
|
||||
transformResponse: (response: any) => {
|
||||
return response.result;
|
||||
},
|
||||
}),
|
||||
}),
|
||||
});
|
||||
export const {
|
||||
@@ -111,4 +130,5 @@ export const {
|
||||
useGetTablesQuery,
|
||||
useGetOrderDetailsQuery,
|
||||
useCancelOrderMutation,
|
||||
useGetDiscountMutation
|
||||
} = branchApi;
|
||||
|
||||
Reference in New Issue
Block a user