Remove useless state

This commit is contained in:
Bill 2021-07-27 15:03:31 -04:00
parent 35ff72eb86
commit 98a169f406

View File

@ -10,7 +10,6 @@ export interface ICatalogState
root: ICatalogPageData; root: ICatalogPageData;
offerRoot: ICatalogOffers; offerRoot: ICatalogOffers;
currentTab: ICatalogPageData; currentTab: ICatalogPageData;
currentPage: ICatalogPageData;
pageParser: ICatalogPageParser; pageParser: ICatalogPageParser;
activeOffer: CatalogPageOfferData; activeOffer: CatalogPageOfferData;
searchResult: ICatalogSearchResult; searchResult: ICatalogSearchResult;
@ -19,7 +18,6 @@ export interface ICatalogState
clubOffers: CatalogClubOfferData[]; clubOffers: CatalogClubOfferData[];
subscriptionInfo: SubscriptionInfo; subscriptionInfo: SubscriptionInfo;
giftConfiguration: GiftWrappingConfiguration; giftConfiguration: GiftWrappingConfiguration;
pendingPageId: number;
} }
export interface ICatalogAction export interface ICatalogAction
@ -29,7 +27,6 @@ export interface ICatalogAction
root?: ICatalogPageData; root?: ICatalogPageData;
offerRoot?: ICatalogOffers; offerRoot?: ICatalogOffers;
currentTab?: ICatalogPageData; currentTab?: ICatalogPageData;
currentPage?: ICatalogPageData;
pageParser?: ICatalogPageParser; pageParser?: ICatalogPageParser;
activeOffer?: CatalogPageOfferData; activeOffer?: CatalogPageOfferData;
searchResult?: ICatalogSearchResult; searchResult?: ICatalogSearchResult;
@ -38,7 +35,6 @@ export interface ICatalogAction
clubOffers?: CatalogClubOfferData[]; clubOffers?: CatalogClubOfferData[];
subscriptionInfo?: SubscriptionInfo; subscriptionInfo?: SubscriptionInfo;
giftConfiguration?: CatalogGiftConfigurationParser; giftConfiguration?: CatalogGiftConfigurationParser;
pendingPageId?: number;
} }
} }
@ -47,7 +43,6 @@ export class CatalogActions
public static RESET_STATE: string = 'CA_RESET_STATE'; public static RESET_STATE: string = 'CA_RESET_STATE';
public static SET_CATALOG_ROOT: string = 'CA_SET_CATALOG_ROOT'; public static SET_CATALOG_ROOT: string = 'CA_SET_CATALOG_ROOT';
public static SET_CATALOG_CURRENT_TAB: string = 'CA_SET_CATALOG_CURRENT_TAB'; public static SET_CATALOG_CURRENT_TAB: string = 'CA_SET_CATALOG_CURRENT_TAB';
public static SET_CATALOG_CURRENT_PAGE: string = 'CA_SET_CATALOG_CURRENT_PAGE';
public static SET_CATALOG_PAGE_PARSER: string = 'CA_SET_CATALOG_PAGE'; public static SET_CATALOG_PAGE_PARSER: string = 'CA_SET_CATALOG_PAGE';
public static SET_CATALOG_ACTIVE_OFFER: string = 'CA_SET_ACTIVE_OFFER'; public static SET_CATALOG_ACTIVE_OFFER: string = 'CA_SET_ACTIVE_OFFER';
public static SET_CLUB_OFFERS: string = 'CA_SET_CLUB_OFFERS'; public static SET_CLUB_OFFERS: string = 'CA_SET_CLUB_OFFERS';
@ -56,14 +51,12 @@ export class CatalogActions
public static SET_SEARCH_RESULT: string = 'CA_SET_SEARCH_RESULT'; public static SET_SEARCH_RESULT: string = 'CA_SET_SEARCH_RESULT';
public static SET_SUBSCRIPTION_INFO: string = 'CA_SET_SUBSCRIPTION_INFO'; public static SET_SUBSCRIPTION_INFO: string = 'CA_SET_SUBSCRIPTION_INFO';
public static SET_GIFT_CONFIGURATION: string = 'CA_SET_GIFT_CONFIGURATION'; public static SET_GIFT_CONFIGURATION: string = 'CA_SET_GIFT_CONFIGURATION';
public static SET_PENDING_PAGE_ID: string = 'CA_SET_PENDING_PAGE_ID';
} }
export const initialCatalog: ICatalogState = { export const initialCatalog: ICatalogState = {
root: null, root: null,
offerRoot: null, offerRoot: null,
currentTab: null, currentTab: null,
currentPage: null,
pageParser: null, pageParser: null,
activeOffer: null, activeOffer: null,
searchResult: null, searchResult: null,
@ -71,8 +64,7 @@ export const initialCatalog: ICatalogState = {
petPalettes: [], petPalettes: [],
clubOffers: null, clubOffers: null,
subscriptionInfo: new SubscriptionInfo(), subscriptionInfo: new SubscriptionInfo(),
giftConfiguration: null, giftConfiguration: null
pendingPageId: -1
} }
export const CatalogReducer: Reducer<ICatalogState, ICatalogAction> = (state, action) => export const CatalogReducer: Reducer<ICatalogState, ICatalogAction> = (state, action) =>
@ -95,11 +87,6 @@ export const CatalogReducer: Reducer<ICatalogState, ICatalogAction> = (state, ac
return { ...state, currentTab, searchResult }; return { ...state, currentTab, searchResult };
} }
case CatalogActions.SET_CATALOG_CURRENT_PAGE: {
const currentPage = (action.payload.currentPage || state.currentPage || null);
return { ...state, currentPage };
}
case CatalogActions.SET_CATALOG_PAGE_PARSER: { case CatalogActions.SET_CATALOG_PAGE_PARSER: {
let pageParser = (Object.create(action.payload.pageParser) as ICatalogPageParser); let pageParser = (Object.create(action.payload.pageParser) as ICatalogPageParser);
let activeOffer = null; let activeOffer = null;
@ -172,11 +159,6 @@ export const CatalogReducer: Reducer<ICatalogState, ICatalogAction> = (state, ac
return { ...state, giftConfiguration }; return { ...state, giftConfiguration };
} }
case CatalogActions.SET_PENDING_PAGE_ID: {
const pendingPageId = (action.payload.pendingPageId || -1);
return { ...state, pendingPageId };
}
default: default:
return state; return state;
} }