refactor: mixin

This commit is contained in:
cha0s 2024-01-05 19:26:41 -06:00
parent 9b8e39bc3c
commit 3553d6ca8d
3 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ export const hooks = {
// if ('production' === NODE_ENV) { // if ('production' === NODE_ENV) {
// return; // return;
// } // }
const {Project, User} = flecks.get('$flecks/db.models'); const {Project, User} = flecks.db.Models;
if (!await User.findOne({where: {email: 'persea@cha0s.io'}})) { if (!await User.findOne({where: {email: 'persea@cha0s.io'}})) {
const user = await User.create({ const user = await User.create({
email: 'persea@cha0s.io', email: 'persea@cha0s.io',

View File

@ -24,7 +24,7 @@ export const hooks = {
}, },
'@flecks/web/server.request.route': (flecks) => async (req, res, next) => { '@flecks/web/server.request.route': (flecks) => async (req, res, next) => {
if (isElectron() && 0 === req.user.id) { if (isElectron() && 0 === req.user.id) {
const {User} = flecks.get('$flecks/db.models'); const {User} = flecks.db.Models;
req.logIn(await User.findByPk(1), next); req.logIn(await User.findByPk(1), next);
return; return;
} }

View File

@ -19,7 +19,7 @@ export * from './state';
export const hooks = { export const hooks = {
'@flecks/react.roots': () => Persea, '@flecks/react.roots': () => Persea,
'@flecks/redux.effects': (flecks) => { '@flecks/redux.effects': (flecks) => {
const withSocket = (fn) => (...args) => fn(...args.concat(flecks.get('$flecks/socket.socket'))); const withSocket = (fn) => (...args) => fn(...args.concat(flecks.socket.client));
return Object.fromEntries( return Object.fromEntries(
[ [
patchJsonResource, patchJsonResource,