Retain filter when changing region tag visibility
This commit is contained in:
parent
f149156def
commit
ea71efb5e6
3 changed files with 16 additions and 3 deletions
|
@ -29,7 +29,10 @@ const schema = {
|
|||
}),
|
||||
locationTags: z.object({
|
||||
location_tags: z.enum(["all", "hide", "only"]),
|
||||
account
|
||||
account,
|
||||
filter_field: z.enum(["band_name", "band_url", "item_title", "item_id", "tag", "why"]).optional(),
|
||||
filter: z.string().regex(/^[^%]+$/).optional(),
|
||||
filter_fuzzy: z.enum(["true"]).optional()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,11 @@ router.post("/api/settings/inline-player", defineEventHandler(async event => {
|
|||
}))
|
||||
|
||||
router.post("/api/settings/location-tags", defineEventHandler(async event => {
|
||||
const {location_tags, account} = await readValidatedBody(event, schema.schema.locationTags.parse)
|
||||
const {location_tags, account, filter, filter_field, filter_fuzzy} = await readValidatedBody(event, schema.schema.locationTags.parse)
|
||||
setCookie(event, "bcex-location-tags", location_tags)
|
||||
return sendRedirect(event, `/${account}/?arrange=tag&shape=grid`)
|
||||
const params = new URLSearchParams({arrange: "tag", shape: "grid"})
|
||||
if (filter) params.set("filter", filter)
|
||||
if (filter_field) params.set("filter_field", filter_field)
|
||||
if (filter_fuzzy) params.set("filter_fuzzy", filter_fuzzy)
|
||||
return sendRedirect(event, `/${account}/?${params}`)
|
||||
}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue