Skip to content

Commit

Permalink
Update max age of cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgrozer committed Jun 30, 2024
1 parent 96cf76e commit 176d226
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 6 additions & 2 deletions components/LoadModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 })
}

Expand Down
12 changes: 9 additions & 3 deletions components/SaveModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 176d226

Please sign in to comment.