Merged in fix/SW-2716-wrong-package-for-breakfast (pull request #2063)

fix: add correct package for callback

* fix: add correct package for callback


Approved-by: Niclas Edenvin
Approved-by: Linus Flood
This commit is contained in:
Bianca Widstam
2025-05-13 06:51:31 +00:00
committed by Linus Flood
parent 7031ad3fae
commit 45f61bd81e
4 changed files with 26 additions and 20 deletions

View File

@@ -43,6 +43,11 @@ export const getAncillarySessionData = ():
| {
formData?: AncillaryFormData
selectedAncillary?: Ancillary["ancillaryContent"][number] | null
packages: {
code: string
quantity: number
comment: string | undefined
}[]
}
| undefined => {
if (typeof window === "undefined") return undefined
@@ -59,9 +64,15 @@ export const getAncillarySessionData = ():
export function setAncillarySessionData({
formData,
selectedAncillary,
packages,
}: {
formData?: AncillaryFormData
selectedAncillary?: Ancillary["ancillaryContent"][number] | null
packages: {
code: string
quantity: number
comment: string | undefined
}[]
}) {
if (typeof window === "undefined") return
@@ -69,7 +80,7 @@ export function setAncillarySessionData({
const currentData = getAncillarySessionData() || {}
sessionStorage.setItem(
ancillarySessionKey,
JSON.stringify({ ...currentData, formData, selectedAncillary })
JSON.stringify({ ...currentData, formData, selectedAncillary, packages })
)
} catch (error) {
console.error("Error writing to session storage:", error)