Persist cookies beyond the session
This commit is contained in:
parent
12f8b8ffd0
commit
7fe77cf359
3 changed files with 4 additions and 4 deletions
|
@ -75,6 +75,6 @@ router.get("/:account/collection-stats", defineEventHandler(async event => {
|
|||
|
||||
router.post("/api/settings/currency", defineEventHandler(async event => {
|
||||
const {currency, account} = await readValidatedBody(event, schema.schema.postCurrency.parse)
|
||||
setCookie(event, "bcex-currency", currency)
|
||||
setCookie(event, "bcex-currency", currency, {secure: true, httpOnly: true, maxAge: 2147483647, sameSite: "lax"})
|
||||
return pugSync.render(event, "includes/collection-stats.pug", {account, currency})
|
||||
}))
|
||||
|
|
|
@ -126,7 +126,7 @@ router.post("/api/load-collection", defineEventHandler(async event => {
|
|||
const {account} = await readValidatedBody(event, schema.schema.account.parse)
|
||||
try {
|
||||
const result = await loadCollection(account)
|
||||
setCookie(event, "accounts", (getCookie(event, "accounts") || "").split("|").concat(account).join("|"))
|
||||
setCookie(event, "accounts", (getCookie(event, "accounts") || "").split("|").concat(account).join("|"), {secure: true, httpOnly: true, maxAge: 2147483647, sameSite: "lax"})
|
||||
return pugSync.render(event, "collection-loaded.pug", result)
|
||||
} catch (cause) {
|
||||
const error = cause instanceof UserVisibleError ? cause
|
||||
|
|
|
@ -11,14 +11,14 @@ const schema = sync.require("./schema")
|
|||
|
||||
router.post("/api/settings/inline-player", defineEventHandler(async event => {
|
||||
const {inline_player} = await readValidatedBody(event, schema.schema.inlinePlayer.parse)
|
||||
setCookie(event, "bcex-inline-player-disabled", String(!inline_player))
|
||||
setCookie(event, "bcex-inline-player-disabled", String(!inline_player), {secure: true, httpOnly: true, maxAge: 2147483647, sameSite: "lax"})
|
||||
setResponseHeader(event, "HX-Refresh", "true")
|
||||
return null
|
||||
}))
|
||||
|
||||
router.post("/api/settings/location-tags", defineEventHandler(async event => {
|
||||
const {location_tags, account, filter, filter_field, filter_fuzzy} = await readValidatedBody(event, schema.schema.locationTags.parse)
|
||||
setCookie(event, "bcex-location-tags", location_tags)
|
||||
setCookie(event, "bcex-location-tags", location_tags, {secure: true, httpOnly: true, maxAge: 2147483647, sameSite: "lax"})
|
||||
const params = new URLSearchParams({arrange: "tag", shape: "grid"})
|
||||
if (filter) params.set("filter", filter)
|
||||
if (filter_field) params.set("filter_field", filter_field)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue