mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-10 15:35:35 +00:00
refactor: split backend by context instead of type 'controllers/models/...'
This commit is contained in:
12
app/user/controllers/theme_controller.ts
Normal file
12
app/user/controllers/theme_controller.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { PREFER_DARK_THEME } from '#user/constants/theme';
|
||||
import { updateThemeValidator } from '#user/validators/update_theme_validator';
|
||||
import type { HttpContext } from '@adonisjs/core/http';
|
||||
|
||||
export default class ThemeController {
|
||||
async index({ request, session, response }: HttpContext) {
|
||||
const { preferDarkTheme } =
|
||||
await request.validateUsing(updateThemeValidator);
|
||||
session.put(PREFER_DARK_THEME, preferDarkTheme);
|
||||
return response.ok({ message: 'ok' });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user