mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 07:03:25 +00:00
feat: create content layout with emotion
This commit is contained in:
34
app/constants/paths.ts
Normal file
34
app/constants/paths.ts
Normal 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;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user