feat: create content layout with emotion

This commit is contained in:
Sonny
2024-04-27 20:00:46 +02:00
committed by Sonny
parent df4185bd62
commit 08dcd7455f
23 changed files with 630 additions and 52 deletions

34
app/constants/paths.ts Normal file
View File

@@ -0,0 +1,34 @@
const PATHS = {
AUTH: {
LOGIN: '/login',
LOGOUT: '/auth/logout',
GOOGLE: '/auth/google',
},
HOME: '/',
APP: '/app',
SHARED: '/shared',
PRIVACY: '/privacy',
TERMS: '/terms',
ADMIN: '/admin',
CATEGORY: {
CREATE: '/category/create',
EDIT: '/category/edit',
REMOVE: '/category/remove',
},
LINK: {
CREATE: '/link/create',
EDIT: '/link/edit',
REMOVE: '/link/remove',
},
API: {
CATEGORY: '/api/category',
LINK: '/api/link',
},
NOT_FOUND: '/404',
SERVER_ERROR: '/505',
AUTHOR: 'https://www.sonny.dev/',
REPO_GITHUB: 'https://github.com/Sonny93/my-links',
EXTENSION: 'https://chromewebstore.google.com/detail/mylinks/agkmlplihacolkakgeccnbhphnepphma',
} as const;
export default PATHS;

View File

@@ -1,9 +1,14 @@
import PATHS from '#constants/paths';
import User from '#models/user';
import type { HttpContext } from '@adonisjs/core/http';
import logger from '@adonisjs/core/services/logger';
export default class UsersController {
private redirectTo = '/';
private redirectTo = PATHS.HOME;
login({ inertia }: HttpContext) {
return inertia.render('login');
}
google = ({ ally }: HttpContext) => ally.use('google').redirect();
@@ -44,13 +49,13 @@ export default class UsersController {
session.flash('flash', 'Successfully authenticated');
logger.info(`[${user.email}] auth success`);
response.redirect('/');
response.redirect(this.redirectTo);
}
async logout({ auth, response, session }: HttpContext) {
await auth.use('web').logout();
session.flash('flash', 'Successfully disconnected');
logger.info(`[${auth.user?.email}] disconnected successfully`);
response.redirect('/');
response.redirect(this.redirectTo);
}
}