Finally finished giant ES6 refactor
This commit is contained in:
parent
c6d48cc424
commit
03e2666958
39 changed files with 553 additions and 635 deletions
|
@ -1,12 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import createHandler from '../lib/react-handler';
|
||||
import {routes} from '../views/app';
|
||||
import { routes } from '../views/app';
|
||||
|
||||
module.exports = function* () {
|
||||
let recents = [];
|
||||
let docs = yield this.db.matches.find().sort({'created_at': -1}).limit(6).toArray();
|
||||
export default function* () {
|
||||
const recents = [];
|
||||
const docs = yield this.db.matches.find().sort({'created_at': -1}).limit(6).toArray();
|
||||
docs.forEach(function(doc) {
|
||||
let shares = Object.keys(doc.services).map(function (key) {return doc.services[key]; });
|
||||
shares.some(function(item) {
|
||||
|
@ -17,9 +15,9 @@ module.exports = function* () {
|
|||
});
|
||||
});
|
||||
|
||||
let Handler = yield createHandler(routes, this.request.url);
|
||||
const Handler = yield createHandler(routes, this.request.url);
|
||||
|
||||
let App = React.createFactory(Handler);
|
||||
const App = React.createFactory(Handler);
|
||||
let content = React.renderToString(new App({recents: recents}));
|
||||
|
||||
content = content.replace('</body></html>', '<script>var recents = ' + JSON.stringify(recents) + '</script></body></html>');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue