Merged in fix/booking-flow-eslint-fix (pull request #3342)
fix: Upgrade booking-flow eslint config * Upgrade booking-flow eslint config Approved-by: Bianca Widstam
This commit is contained in:
@@ -2,11 +2,11 @@ import * as Sentry from "@sentry/bun";
|
|||||||
import { Elysia, t } from "elysia";
|
import { Elysia, t } from "elysia";
|
||||||
|
|
||||||
import { redis } from "@/services/redis";
|
import { redis } from "@/services/redis";
|
||||||
|
import { getAllKeys } from "@/services/redis/getAllKeys";
|
||||||
import { queueDelete, queueDeleteMultiple } from "@/services/redis/queueDelete";
|
import { queueDelete, queueDeleteMultiple } from "@/services/redis/queueDelete";
|
||||||
import { loggerModule } from "@/utils/logger";
|
import { loggerModule } from "@/utils/logger";
|
||||||
import { truncate } from "@/utils/truncate";
|
import { truncate } from "@/utils/truncate";
|
||||||
import { validateKey } from "@/utils/validateKey";
|
import { validateKey } from "@/utils/validateKey";
|
||||||
import { getAllKeys } from "@/services/redis/getAllKeys";
|
|
||||||
|
|
||||||
const QUERY_TYPE = t.Object({ key: t.String({}) });
|
const QUERY_TYPE = t.Object({ key: t.String({}) });
|
||||||
const DELETEMULTIPLE_BODY_TYPE = t.Object({
|
const DELETEMULTIPLE_BODY_TYPE = t.Object({
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { env } from "@/env";
|
import { env } from "@/env";
|
||||||
import { redis } from ".";
|
|
||||||
import { timeout } from "@/utils/timeout";
|
import { timeout } from "@/utils/timeout";
|
||||||
|
|
||||||
|
import { redis } from ".";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all Redis keys that match any of the provided patterns.
|
* Retrieves all Redis keys that match any of the provided patterns.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import { Queue, Worker } from "bullmq";
|
import { Queue, Worker } from "bullmq";
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
|
||||||
import { env } from "@/env";
|
|
||||||
import { sentry } from "@/server/sentry.server.config";
|
import { sentry } from "@/server/sentry.server.config";
|
||||||
import { loggerModule } from "@/utils/logger";
|
import { loggerModule } from "@/utils/logger";
|
||||||
import { timeout } from "@/utils/timeout";
|
|
||||||
|
|
||||||
import { bullmqredis, redis } from ".";
|
import { bullmqredis, redis } from ".";
|
||||||
import { getAllKeys } from "./getAllKeys";
|
import { getAllKeys } from "./getAllKeys";
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ export async function TopCampaign({ topCampaign }: TopCampaignProps) {
|
|||||||
<h2 className={styles.heading}>{heading}</h2>
|
<h2 className={styles.heading}>{heading}</h2>
|
||||||
</Typography>
|
</Typography>
|
||||||
) : null}
|
) : null}
|
||||||
|
{/* eslint-disable-next-line react-hooks/static-components */}
|
||||||
<CampaignContent />
|
<CampaignContent />
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function DeliveryMethodStep() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<Select
|
<Select
|
||||||
name="deliveryTime"
|
name="deliveryTime"
|
||||||
label={""}
|
label=""
|
||||||
items={deliveryTimeOptions}
|
items={deliveryTimeOptions}
|
||||||
registerOptions={{ required: true }}
|
registerOptions={{ required: true }}
|
||||||
isNestedInModal
|
isNestedInModal
|
||||||
|
|||||||
@@ -1,50 +1,30 @@
|
|||||||
import path from "node:path"
|
import { defineConfig, globalIgnores } from "eslint/config"
|
||||||
import { fileURLToPath } from "node:url"
|
import nextVitals from "eslint-config-next/core-web-vitals"
|
||||||
|
import nextTs from "eslint-config-next/typescript"
|
||||||
import { FlatCompat } from "@eslint/eslintrc"
|
|
||||||
import js from "@eslint/js"
|
|
||||||
import typescriptEslint from "@typescript-eslint/eslint-plugin"
|
|
||||||
import tsParser from "@typescript-eslint/parser"
|
|
||||||
import { defineConfig } from "eslint/config"
|
|
||||||
import formatjs from "eslint-plugin-formatjs"
|
import formatjs from "eslint-plugin-formatjs"
|
||||||
import simpleImportSort from "eslint-plugin-simple-import-sort"
|
import simpleImportSort from "eslint-plugin-simple-import-sort"
|
||||||
|
|
||||||
const compat = new FlatCompat({
|
|
||||||
recommendedConfig: js.configs.recommended,
|
|
||||||
allConfig: js.configs.all,
|
|
||||||
})
|
|
||||||
|
|
||||||
const packageDir = path.dirname(fileURLToPath(import.meta.url))
|
|
||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
|
...nextVitals,
|
||||||
|
...nextTs,
|
||||||
|
globalIgnores([
|
||||||
|
".next/**",
|
||||||
|
"node_modules/**",
|
||||||
|
"dist/**",
|
||||||
|
"build/**",
|
||||||
|
"coverage/**",
|
||||||
|
"*.config.js",
|
||||||
|
"*.config.ts",
|
||||||
|
"*.config.mjs",
|
||||||
|
]),
|
||||||
|
|
||||||
{
|
{
|
||||||
extends: compat.extends(
|
files: ["**/*.{js,jsx,ts,tsx,mts}"],
|
||||||
"next/core-web-vitals",
|
|
||||||
"plugin:@typescript-eslint/recommended"
|
|
||||||
),
|
|
||||||
plugins: {
|
plugins: {
|
||||||
"simple-import-sort": simpleImportSort,
|
"simple-import-sort": simpleImportSort,
|
||||||
"@typescript-eslint": typescriptEslint,
|
|
||||||
formatjs,
|
formatjs,
|
||||||
},
|
},
|
||||||
|
|
||||||
languageOptions: {
|
|
||||||
parser: tsParser,
|
|
||||||
},
|
|
||||||
|
|
||||||
settings: {
|
|
||||||
// Ensure the plugin can resolve workspace packages and TS path aliases
|
|
||||||
"import/resolver": {
|
|
||||||
typescript: {
|
|
||||||
project: [path.join(packageDir, "tsconfig.json")],
|
|
||||||
alwaysTryTypes: true,
|
|
||||||
},
|
|
||||||
node: {
|
|
||||||
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
"no-console": "warn",
|
"no-console": "warn",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
@@ -57,15 +37,8 @@ export default defineConfig([
|
|||||||
propElementValues: "always",
|
propElementValues: "always",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
"react-hooks/incompatible-library": "off",
|
||||||
"import/no-relative-packages": "error",
|
"import/no-relative-packages": "error",
|
||||||
"import/no-extraneous-dependencies": [
|
|
||||||
"warn",
|
|
||||||
{
|
|
||||||
includeInternal: true,
|
|
||||||
includeTypes: true,
|
|
||||||
packageDir: [packageDir],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"simple-import-sort/imports": [
|
"simple-import-sort/imports": [
|
||||||
"warn",
|
"warn",
|
||||||
{
|
{
|
||||||
@@ -113,19 +86,9 @@ export default defineConfig([
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
"formatjs/enforce-default-message": ["error", "literal"],
|
|
||||||
"formatjs/enforce-placeholders": ["error"],
|
|
||||||
"formatjs/enforce-plural-rules": ["error"],
|
|
||||||
"formatjs/no-literal-string-in-jsx": ["error"],
|
|
||||||
"formatjs/no-multiple-whitespaces": ["error"],
|
|
||||||
"formatjs/no-multiple-plurals": ["error"],
|
|
||||||
"formatjs/no-invalid-icu": ["error"],
|
|
||||||
"formatjs/enforce-id": ["error"],
|
|
||||||
"formatjs/no-complex-selectors": ["error"],
|
|
||||||
"formatjs/no-useless-message": ["error"],
|
|
||||||
"formatjs/prefer-pound-in-plural": ["error"],
|
|
||||||
|
|
||||||
"@typescript-eslint/consistent-type-imports": "error",
|
"@typescript-eslint/consistent-type-imports": "error",
|
||||||
|
"@typescript-eslint/no-empty-object-type": "off",
|
||||||
|
"@typescript-eslint/no-require-imports": "off",
|
||||||
|
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
@@ -141,6 +104,18 @@ export default defineConfig([
|
|||||||
],
|
],
|
||||||
|
|
||||||
"@next/next/no-html-link-for-pages": "off",
|
"@next/next/no-html-link-for-pages": "off",
|
||||||
|
|
||||||
|
"formatjs/enforce-default-message": ["error", "literal"],
|
||||||
|
"formatjs/enforce-placeholders": ["error"],
|
||||||
|
"formatjs/enforce-plural-rules": ["error"],
|
||||||
|
"formatjs/no-literal-string-in-jsx": ["error"],
|
||||||
|
"formatjs/no-multiple-whitespaces": ["error"],
|
||||||
|
"formatjs/no-multiple-plurals": ["error"],
|
||||||
|
"formatjs/no-invalid-icu": ["error"],
|
||||||
|
"formatjs/enforce-id": ["error"],
|
||||||
|
"formatjs/no-complex-selectors": ["error"],
|
||||||
|
"formatjs/no-useless-message": ["error"],
|
||||||
|
"formatjs/prefer-pound-in-plural": ["error"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export default function MemberPriceModal() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (join) {
|
if (join) {
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||||
setIsOpen(true)
|
setIsOpen(true)
|
||||||
}
|
}
|
||||||
}, [join])
|
}, [join])
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export default function Signup({
|
|||||||
<div className={styles.additionalFormData}>
|
<div className={styles.additionalFormData}>
|
||||||
<div
|
<div
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
|
// eslint-disable-next-line react-hooks/immutability
|
||||||
refs.current.zipCode = el
|
refs.current.zipCode = el
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -64,6 +65,7 @@ export default function Signup({
|
|||||||
<div
|
<div
|
||||||
className={styles.dateField}
|
className={styles.dateField}
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
|
// eslint-disable-next-line react-hooks/immutability
|
||||||
refs.current.dateOfBirth = el
|
refs.current.dateOfBirth = el
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -110,6 +112,7 @@ export default function Signup({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
|
// eslint-disable-next-line react-hooks/immutability
|
||||||
refs.current.membershipNo = el
|
refs.current.membershipNo = el
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ function useBookingErrorAlert() {
|
|||||||
const selectRateReturnUrl = getSelectRateReturnUrl()
|
const selectRateReturnUrl = getSelectRateReturnUrl()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||||
setShowAlert(!!errorCode)
|
setShowAlert(!!errorCode)
|
||||||
}, [errorCode])
|
}, [errorCode])
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ export default function PaymentClient({
|
|||||||
if (booking.reservationStatus == BookingStatusEnum.BookingCompleted) {
|
if (booking.reservationStatus == BookingStatusEnum.BookingCompleted) {
|
||||||
clearBookingWidgetState()
|
clearBookingWidgetState()
|
||||||
// Cookie is used by Booking Confirmation page to validate that the user came from payment callback
|
// Cookie is used by Booking Confirmation page to validate that the user came from payment callback
|
||||||
|
// eslint-disable-next-line react-hooks/immutability
|
||||||
document.cookie = `bcsig=${result.sig}; Path=/; Max-Age=60; Secure; SameSite=Strict`
|
document.cookie = `bcsig=${result.sig}; Path=/; Max-Age=60; Secure; SameSite=Strict`
|
||||||
const confirmationUrl = `${bookingConfirmation(lang)}?RefId=${encodeURIComponent(mainRoom.refId)}`
|
const confirmationUrl = `${bookingConfirmation(lang)}?RefId=${encodeURIComponent(mainRoom.refId)}`
|
||||||
router.push(confirmationUrl)
|
router.push(confirmationUrl)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export default function Section({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (step === EnterDetailsStepEnum.selectBed && bedType) {
|
if (step === EnterDetailsStepEnum.selectBed && bedType) {
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||||
setTitle(bedType.description)
|
setTitle(bedType.description)
|
||||||
}
|
}
|
||||||
// If breakfast step, check if an option has been selected
|
// If breakfast step, check if an option has been selected
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ export function MapContainer({ children }: { children: React.ReactNode }) {
|
|||||||
|
|
||||||
if (scrollHeightWhenOpened === 0) {
|
if (scrollHeightWhenOpened === 0) {
|
||||||
const scrollY = window.scrollY
|
const scrollY = window.scrollY
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||||
setScrollHeightWhenOpened(scrollY)
|
setScrollHeightWhenOpened(scrollY)
|
||||||
window.scrollTo({ top: 0, behavior: "instant" })
|
window.scrollTo({ top: 0, behavior: "instant" })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ export default function FilterAndSortModal({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (activeFilters.length) {
|
if (activeFilters.length) {
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||||
setSelectedFilters(activeFilters)
|
setSelectedFilters(activeFilters)
|
||||||
}
|
}
|
||||||
}, [activeFilters])
|
}, [activeFilters])
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export default function FilterContent({
|
|||||||
selectedFilters[0] || []
|
selectedFilters[0] || []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||||
setFilteredHotelIds(filteredIds)
|
setFilteredHotelIds(filteredIds)
|
||||||
}, [filters, activeFilters, setFilteredHotelIds, showOnlyBookingCodeRates])
|
}, [filters, activeFilters, setFilteredHotelIds, showOnlyBookingCodeRates])
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ export default function EnterDetailsProvider({
|
|||||||
const [hasInitializedStore, setHasInitializedStore] = useState(false)
|
const [hasInitializedStore, setHasInitializedStore] = useState(false)
|
||||||
const storeRef = useRef<EnterDetailsStore>(undefined)
|
const storeRef = useRef<EnterDetailsStore>(undefined)
|
||||||
const pointsCurrency = useGetPointsCurrency()
|
const pointsCurrency = useGetPointsCurrency()
|
||||||
|
// eslint-disable-next-line react-hooks/refs
|
||||||
if (!storeRef.current) {
|
if (!storeRef.current) {
|
||||||
const initialData: InitialState = {
|
const initialData: InitialState = {
|
||||||
booking,
|
booking,
|
||||||
@@ -242,6 +243,7 @@ export default function EnterDetailsProvider({
|
|||||||
}, [booking, rooms, user])
|
}, [booking, rooms, user])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
// eslint-disable-next-line react-hooks/refs
|
||||||
<EnterDetailsContext.Provider value={storeRef.current}>
|
<EnterDetailsContext.Provider value={storeRef.current}>
|
||||||
{hasInitializedStore ? children : <LoadingSpinner fullPage />}
|
{hasInitializedStore ? children : <LoadingSpinner fullPage />}
|
||||||
</EnterDetailsContext.Provider>
|
</EnterDetailsContext.Provider>
|
||||||
|
|||||||
@@ -427,6 +427,7 @@ export function SelectRateProvider({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/immutability
|
||||||
updatedRoom.packages = packages
|
updatedRoom.packages = packages
|
||||||
updateBooking(selectRateBooking)
|
updateBooking(selectRateBooking)
|
||||||
setActiveRoomIndex(roomIndex)
|
setActiveRoomIndex(roomIndex)
|
||||||
@@ -448,6 +449,7 @@ export function SelectRateProvider({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/immutability
|
||||||
updatedRoom.rateCode = rateCode
|
updatedRoom.rateCode = rateCode
|
||||||
updatedRoom.roomTypeCode = roomTypeCode
|
updatedRoom.roomTypeCode = roomTypeCode
|
||||||
updatedRoom.counterRateCode = counterRateCode || null
|
updatedRoom.counterRateCode = counterRateCode || null
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export function useAvailablePaymentOptions(
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (window.ApplePaySession) {
|
if (window.ApplePaySession) {
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||||
setAvailablePaymentOptions(otherPaymentOptions)
|
setAvailablePaymentOptions(otherPaymentOptions)
|
||||||
}
|
}
|
||||||
}, [otherPaymentOptions, setAvailablePaymentOptions])
|
}, [otherPaymentOptions, setAvailablePaymentOptions])
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export function useBookingWidgetState() {
|
|||||||
storedTo.isAfter(storedFrom)
|
storedTo.isAfter(storedFrom)
|
||||||
|
|
||||||
if (isDateParamValid && stored.rooms?.length) {
|
if (isDateParamValid && stored.rooms?.length) {
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||||
setBookingState({
|
setBookingState({
|
||||||
fromDate: storedFrom.format("YYYY-MM-DD"),
|
fromDate: storedFrom.format("YYYY-MM-DD"),
|
||||||
toDate: storedTo.format("YYYY-MM-DD"),
|
toDate: storedTo.format("YYYY-MM-DD"),
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export function useHandleBookingStatus({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...query,
|
...query,
|
||||||
|
// eslint-disable-next-line react-hooks/refs
|
||||||
isTimeout: retries.current >= maxRetries,
|
isTimeout: retries.current >= maxRetries,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export async function BookingConfirmationPage({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const expire = Number(decrypt(sig))
|
const expire = Number(decrypt(sig))
|
||||||
|
// eslint-disable-next-line react-hooks/purity
|
||||||
const now = Math.floor(Date.now() / 1000)
|
const now = Math.floor(Date.now() / 1000)
|
||||||
if (typeof expire === "number" && !isNaN(expire) && now > expire) {
|
if (typeof expire === "number" && !isNaN(expire) && now > expire) {
|
||||||
redirect(`/${lang}`)
|
redirect(`/${lang}`)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
|
|
||||||
import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/paymentCallbackStatusEnum"
|
import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/paymentCallbackStatusEnum"
|
||||||
|
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
||||||
import {
|
import {
|
||||||
bookingConfirmation,
|
bookingConfirmation,
|
||||||
details,
|
details,
|
||||||
@@ -17,10 +18,9 @@ import { HandleSuccessCallback } from "../components/EnterDetails/Payment/Paymen
|
|||||||
import { serverClient } from "../trpc"
|
import { serverClient } from "../trpc"
|
||||||
|
|
||||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||||
|
import type { CreateBookingSchema } from "@scandic-hotels/trpc/routers/booking/mutation/create/schema"
|
||||||
|
|
||||||
import type { NextSearchParams } from "../types"
|
import type { NextSearchParams } from "../types"
|
||||||
import { CreateBookingSchema } from "@scandic-hotels/trpc/routers/booking/mutation/create/schema"
|
|
||||||
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
|
||||||
|
|
||||||
type PaymentCallbackPageProps = {
|
type PaymentCallbackPageProps = {
|
||||||
lang: Lang
|
lang: Lang
|
||||||
@@ -118,6 +118,7 @@ export async function PaymentCallbackPage({
|
|||||||
await caller.booking.validatePartnerPayment({ confirmationNumber })
|
await caller.booking.validatePartnerPayment({ confirmationNumber })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/purity
|
||||||
const expire = Math.floor(Date.now() / 1000) + 60
|
const expire = Math.floor(Date.now() / 1000) + 60
|
||||||
const sig = encrypt(expire.toString())
|
const sig = encrypt(expire.toString())
|
||||||
const confirmationUrl = `${bookingConfirmation(lang)}?RefId=${encodeURIComponent(refId)}`
|
const confirmationUrl = `${bookingConfirmation(lang)}?RefId=${encodeURIComponent(refId)}`
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export async function SelectRatePage({
|
|||||||
// If someone tries to update the url with
|
// If someone tries to update the url with
|
||||||
// a bookingCode also, then we need to remove it
|
// a bookingCode also, then we need to remove it
|
||||||
if (isRedemption && searchParams.bookingCode) {
|
if (isRedemption && searchParams.bookingCode) {
|
||||||
|
// eslint-disable-next-line react-hooks/immutability
|
||||||
delete searchParams.bookingCode
|
delete searchParams.bookingCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export function BookingConfirmationProvider({
|
|||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const storeRef = useRef<BookingConfirmationStore>(undefined)
|
const storeRef = useRef<BookingConfirmationStore>(undefined)
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/refs
|
||||||
if (!storeRef.current) {
|
if (!storeRef.current) {
|
||||||
const totalBookingPrice = rooms.reduce((acc, room) => {
|
const totalBookingPrice = rooms.reduce((acc, room) => {
|
||||||
const reservationTotalPrice = room?.totalPrice || 0
|
const reservationTotalPrice = room?.totalPrice || 0
|
||||||
@@ -105,6 +106,7 @@ export function BookingConfirmationProvider({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
// eslint-disable-next-line react-hooks/refs
|
||||||
<BookingConfirmationContext.Provider value={storeRef.current}>
|
<BookingConfirmationContext.Provider value={storeRef.current}>
|
||||||
{children}
|
{children}
|
||||||
</BookingConfirmationContext.Provider>
|
</BookingConfirmationContext.Provider>
|
||||||
|
|||||||
Reference in New Issue
Block a user