refactor the use of plain string order types
This commit is contained in:
@@ -53,7 +53,7 @@ interface CartState {
|
||||
collectionMethod: string;
|
||||
phone: string;
|
||||
paymentMethod: string;
|
||||
orderType: string;
|
||||
orderType: OrderType | "";
|
||||
useLoyaltyPoints: boolean;
|
||||
loyaltyValidationError: string | null;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ const initialState: CartState = {
|
||||
),
|
||||
phone: getFromLocalStorage(CART_STORAGE_KEYS.PHONE, ""),
|
||||
paymentMethod: getFromLocalStorage(CART_STORAGE_KEYS.PAYMENT_METHOD, ""),
|
||||
orderType: getFromLocalStorage(CART_STORAGE_KEYS.ORDER_TYPE, ""),
|
||||
orderType: getFromLocalStorage(CART_STORAGE_KEYS.ORDER_TYPE, "" as OrderType | ""),
|
||||
useLoyaltyPoints: getFromLocalStorage(
|
||||
CART_STORAGE_KEYS.USE_LOYALTY_POINTS,
|
||||
false,
|
||||
@@ -435,7 +435,7 @@ const orderSlice = createSlice({
|
||||
);
|
||||
}
|
||||
},
|
||||
updateOrderType(state, action: PayloadAction<string>) {
|
||||
updateOrderType(state, action: PayloadAction<OrderType>) {
|
||||
state.orderType = action.payload;
|
||||
|
||||
// Sync to localStorage
|
||||
@@ -604,7 +604,7 @@ export const selectGrandTotal = (state: RootState) => {
|
||||
const taxAmount = selectTaxAmount(state);
|
||||
const subtotal = selectCartTotal(state);
|
||||
const deliveryFee =
|
||||
state.order.orderType != OrderType.DineIn
|
||||
state.order.orderType !== OrderType.DineIn
|
||||
? Number(state.order.restaurant?.delivery_fees) || 0
|
||||
: 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user