update restaurant details source & add loyalty icon
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
ORDERS_URL,
|
||||
PRODUCTS_AND_CATEGORIES_URL,
|
||||
RESTAURANT_DETAILS_URL,
|
||||
TABLES_URL
|
||||
TABLES_URL,
|
||||
} from "utils/constants";
|
||||
|
||||
import { OrderDetails } from "pages/checkout/hooks/types";
|
||||
@@ -16,10 +16,15 @@ import { baseApi } from "./apiSlice";
|
||||
export const branchApi = baseApi.injectEndpoints({
|
||||
endpoints: (builder) => ({
|
||||
getRestaurantDetails: builder.query<RestaurantDetails, string | void>({
|
||||
query: (restaurantId: string) =>
|
||||
`${RESTAURANT_DETAILS_URL}${restaurantId}`,
|
||||
query: (restaurantId: string) => ({
|
||||
url: RESTAURANT_DETAILS_URL,
|
||||
method: "POST",
|
||||
body: {
|
||||
restaurant_id: restaurantId,
|
||||
},
|
||||
}),
|
||||
transformResponse: (response: any) => {
|
||||
return response.result;
|
||||
return response?.result?.restaurants?.[0];
|
||||
},
|
||||
}),
|
||||
getMenu: builder.query<any, string | void>({
|
||||
@@ -55,10 +60,7 @@ export const branchApi = baseApi.injectEndpoints({
|
||||
}),
|
||||
invalidatesTags: ["Orders"],
|
||||
}),
|
||||
getTables: builder.query<
|
||||
any,
|
||||
{ restaurantID: string; tableType: string }
|
||||
>({
|
||||
getTables: builder.query<any, { restaurantID: string; tableType: string }>({
|
||||
query: ({
|
||||
restaurantID,
|
||||
tableType,
|
||||
@@ -77,8 +79,17 @@ export const branchApi = baseApi.injectEndpoints({
|
||||
return response.result.data;
|
||||
},
|
||||
}),
|
||||
getOrderDetails: builder.query<OrderDetails, { orderID: string; restaurantID: string }>({
|
||||
query: ({ orderID, restaurantID }: { orderID: string; restaurantID: string }) => ({
|
||||
getOrderDetails: builder.query<
|
||||
OrderDetails,
|
||||
{ orderID: string; restaurantID: string }
|
||||
>({
|
||||
query: ({
|
||||
orderID,
|
||||
restaurantID,
|
||||
}: {
|
||||
orderID: string;
|
||||
restaurantID: string;
|
||||
}) => ({
|
||||
url: `${ORDER_DETAILS_URL}/${orderID}`,
|
||||
method: "POST",
|
||||
body: {
|
||||
@@ -98,5 +109,5 @@ export const {
|
||||
useGetOrdersQuery,
|
||||
useGetTablesQuery,
|
||||
useGetOrderDetailsQuery,
|
||||
useCancelOrderMutation
|
||||
useCancelOrderMutation,
|
||||
} = branchApi;
|
||||
|
||||
Reference in New Issue
Block a user