integrate showCartItems api in the CartPage
This commit is contained in:
@@ -3,13 +3,15 @@ import { attractionsApi } from "./services/attractions.service";
|
||||
import { citiesApi } from "./services/cities.service";
|
||||
import { authApi } from "./services/auth.service";
|
||||
import { profileApi } from "./services/profile.service";
|
||||
import { cardsApi } from "./services/cards.service";
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
[attractionsApi.reducerPath]: attractionsApi.reducer,
|
||||
[citiesApi.reducerPath]: citiesApi.reducer,
|
||||
[authApi.reducerPath]: authApi.reducer,
|
||||
[profileApi.reducerPath]: profileApi.reducer
|
||||
[profileApi.reducerPath]: profileApi.reducer,
|
||||
[cardsApi.reducerPath]:cardsApi.reducer
|
||||
|
||||
},
|
||||
|
||||
@@ -18,7 +20,8 @@ export const store = configureStore({
|
||||
attractionsApi.middleware,
|
||||
citiesApi.middleware,
|
||||
authApi.middleware,
|
||||
profileApi.middleware
|
||||
profileApi.middleware,
|
||||
cardsApi.middleware
|
||||
),
|
||||
});
|
||||
export type RootState = ReturnType<typeof store.getState>;
|
||||
|
||||
37
src/Redux/services/cards.service.ts
Normal file
37
src/Redux/services/cards.service.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
import { createApi } from "@reduxjs/toolkit/query/react";
|
||||
import { baseQuery } from "../baseQuery";
|
||||
|
||||
export const cardsApi = createApi({
|
||||
reducerPath: "cardsApi",
|
||||
baseQuery,
|
||||
|
||||
tagTypes: ["cardsInCart"],
|
||||
|
||||
endpoints: (builder) => ({
|
||||
|
||||
getCardsinCart: builder.query({
|
||||
query: (cityId) => {
|
||||
const params = new URLSearchParams()
|
||||
params.append('cityXid', cityId);
|
||||
return `/website/passes/cart/passes?${params.toString()}`
|
||||
},
|
||||
providesTags: ["cardsInCart"]
|
||||
}),
|
||||
|
||||
getUpcomingCities: builder.query({
|
||||
query: (listType) => `/cities/list/all?listType=${listType}`,
|
||||
|
||||
}),
|
||||
|
||||
getCheckoutPageData:builder.query({
|
||||
query: (cityId) => `/website/pass/${cityId}`,
|
||||
|
||||
}),
|
||||
})
|
||||
});
|
||||
|
||||
export const {
|
||||
useGetCardsinCartQuery,
|
||||
useGetCheckoutPageDataQuery
|
||||
} = cardsApi;
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user