Fix general category handling
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
const PUBLIC_SERVER_URL = process.env['PUBLIC_SERVER_URL'];
|
||||
import { redirect, type Actions } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { getRandomBackground } from '$lib';
|
||||
import { themes } from '$lib';
|
||||
|
||||
const serverEndpoint = PUBLIC_SERVER_URL || 'http://localhost:8000';
|
||||
|
||||
@@ -9,21 +8,7 @@ export const actions: Actions = {
|
||||
setTheme: async ({ url, cookies }) => {
|
||||
const theme = url.searchParams.get('theme');
|
||||
// change the theme only if it is one of the allowed themes
|
||||
if (
|
||||
theme &&
|
||||
[
|
||||
'light',
|
||||
'dark',
|
||||
'night',
|
||||
'retro',
|
||||
'forest',
|
||||
'aqua',
|
||||
'forest',
|
||||
'aestheticLight',
|
||||
'aestheticDark',
|
||||
'emerald'
|
||||
].includes(theme)
|
||||
) {
|
||||
if (theme && themes.find((t) => t.name === theme)) {
|
||||
cookies.set('colortheme', theme, {
|
||||
path: '/',
|
||||
maxAge: 60 * 60 * 24 * 365
|
||||
|
||||
Reference in New Issue
Block a user