From 176d22603391302d23000b2998354f2098611589 Mon Sep 17 00:00:00 2001 From: mac Date: Mon, 1 Jul 2024 00:19:36 +0300 Subject: [PATCH] Update max age of cookies --- components/LoadModal.jsx | 8 ++++++-- components/SaveModal.jsx | 12 +++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/components/LoadModal.jsx b/components/LoadModal.jsx index d79d911..ca1045c 100644 --- a/components/LoadModal.jsx +++ b/components/LoadModal.jsx @@ -22,7 +22,9 @@ export default ({ modalIsOpen, closeModal }) => { }) const palette = palettes[paletteIndex] - setCookie('selectedPaletteId', palette.id) + setCookie('selectedPaletteId', palette.id, { + maxAge: 315360000 + }) setState({ colors: palette.colors, selectedPaletteId: palette.id @@ -38,7 +40,9 @@ export default ({ modalIsOpen, closeModal }) => { search: { id: paletteId } }) newPalettes.splice(paletteIndex, 1) - setCookie('palettes', newPalettes) + setCookie('palettes', newPalettes, { + maxAge: 315360000 + }) setState({ palettes: newPalettes }) } diff --git a/components/SaveModal.jsx b/components/SaveModal.jsx index 0668834..d55809c 100644 --- a/components/SaveModal.jsx +++ b/components/SaveModal.jsx @@ -40,7 +40,9 @@ export default ({ modalIsOpen, closeModal }) => { const newPalettes = [...palettes] newPalettes[paletteIndex].colors = colors - setCookie('palettes', newPalettes) + setCookie('palettes', newPalettes, { + maxAge: 315360000 + }) setState({ palettes: newPalettes }) } else { const newPaletteId = uuid() @@ -51,8 +53,12 @@ export default ({ modalIsOpen, closeModal }) => { name: values.paletteName }) - setCookie('palettes', newPalettes) - setCookie('selectedPaletteId', newPaletteId) + setCookie('palettes', newPalettes, { + maxAge: 315360000 + }) + setCookie('selectedPaletteId', newPaletteId, { + maxAge: 315360000 + }) setState({ palettes: newPalettes, selectedPaletteId: newPaletteId