fix: theme persistence

save user theme preferences  in session instead of localStorage
This commit is contained in:
Sonny
2024-05-13 23:58:08 +02:00
committed by Sonny
parent f0e64c19fd
commit 243984ca66
7 changed files with 35 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
import { PREFER_DARK_THEME } from '#constants/session';
import { defineConfig } from '@adonisjs/inertia';
export default defineConfig({
@@ -11,6 +12,7 @@ export default defineConfig({
*/
sharedData: {
errors: (ctx) => ctx.session?.flashMessages.get('errors'),
preferDarkTheme: (ctx) => ctx.session.get(PREFER_DARK_THEME, true),
auth: async (ctx) => {
await ctx.auth?.check();
return {