refactor(passport): platform out of config
This commit is contained in:
parent
3eb72c9ae1
commit
8962f53aba
|
@ -5,6 +5,20 @@ import {user, users} from './state';
|
|||
export * from './state';
|
||||
|
||||
export const hooks = {
|
||||
'@flecks/core.config': () => ({
|
||||
/**
|
||||
* Path to redirect to after failed login.
|
||||
*/
|
||||
failureRedirect: '/',
|
||||
/**
|
||||
* Path to redirect to after logout.
|
||||
*/
|
||||
logoutRedirect: '/',
|
||||
/**
|
||||
* Path to redirect to after successful login.
|
||||
*/
|
||||
successRedirect: '/',
|
||||
}),
|
||||
'@flecks/redux.slices': () => ({user, users}),
|
||||
'@flecks/socket.packets': Flecks.provide(require.context('./packets')),
|
||||
};
|
||||
|
|
|
@ -5,20 +5,6 @@ const debug = D('@flecks/passport');
|
|||
const debugSilly = debug.extend('silly');
|
||||
|
||||
export const hooks = {
|
||||
'@flecks/core.config': () => ({
|
||||
/**
|
||||
* Path to redirect to after failed login.
|
||||
*/
|
||||
failureRedirect: '/',
|
||||
/**
|
||||
* Path to redirect to after logout.
|
||||
*/
|
||||
logoutRedirect: '/',
|
||||
/**
|
||||
* Path to redirect to after successful login.
|
||||
*/
|
||||
successRedirect: '/',
|
||||
}),
|
||||
'@flecks/db.models': Flecks.provide(require.context('./models')),
|
||||
'@flecks/socket.packets.decorate': Flecks.decorate(require.context('./packets/decorators')),
|
||||
'@flecks/web/server.request.route': Flecks.priority(
|
||||
|
@ -103,7 +89,7 @@ export const hooks = {
|
|||
failureRedirect,
|
||||
logoutRedirect,
|
||||
successRedirect,
|
||||
} = flecks.get('@flecks/passport/server');
|
||||
} = flecks.get('@flecks/passport');
|
||||
const routes = [
|
||||
{
|
||||
method: 'get',
|
||||
|
|
|
@ -8,7 +8,7 @@ export default (Logout, flecks) => {
|
|||
await new Promise((r, e) => {
|
||||
req.session.save((error) => (error ? e(error) : r()));
|
||||
});
|
||||
socket.send(['Redirect', flecks.get('@flecks/passport/server.logoutRedirect')]);
|
||||
socket.send(['Redirect', flecks.get('@flecks/passport.logoutRedirect')]);
|
||||
}
|
||||
|
||||
static validate(packet, {req}) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user