Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = function(config) {
webpack: {
module: {
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/, loader: "babel-loader"}
{ test: /\.jsx?$/, exclude: /node_modules/, loader: "babel-loader?stage=0"}
],
postLoaders: [{
test: /\.jsx?$/,
Expand Down Expand Up @@ -105,4 +105,4 @@ module.exports = function(config) {
'karma-phantomjs-launcher'
],
});
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"webpack-dev-server": "^1.7.0"
},
"dependencies": {
"babel-core": "^5.4.3",
"babel-loader": "^5.1.2",
"babel-core": "^5.4.7",
"babel-loader": "^5.1.3",
"express": "^4.12.3",
"react": "^0.13.3",
"react-router": "^0.13.3",
Expand Down
2 changes: 1 addition & 1 deletion src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ Router.run(routes, Router.HistoryLocation, function(Handler, state) {
fetchData(state.routes, state.params).then((data) => {
React.render(<Handler data={data} />, document.getElementById(DOM_APP_EL_ID));
});
});
});
9 changes: 4 additions & 5 deletions src/pages/home/page.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { getData } from "../../common/request";


export default class HomePage extends React.Component {
componentWillMount() {
console.log("[HomePage] will mount with server response: ", this.props.data.home);
Expand All @@ -16,8 +15,8 @@ export default class HomePage extends React.Component {
</div>
);
}
}

HomePage.fetchData = function(params) {
return getData("/home");
}
static fetchData = function(params) {
return getData("/home");
}
}
8 changes: 4 additions & 4 deletions src/pages/landing/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export default class LandingPage extends React.Component {
</div>
);
}
}

LandingPage.fetchData = function(params) {
return getData("/landing");
}
static fetchData = function(params) {
return getData("/landing");
}
}
20 changes: 10 additions & 10 deletions src/routers/logged_in.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import Router from "react-router";
let { Route, DefaultRoute, RouteHandler, Link } = Router;
import { Route, DefaultRoute, RouteHandler, Link } from "react-router";

import HomePage from "../pages/home/page";

Expand All @@ -23,12 +22,13 @@ export default class LoggedInRouter extends React.Component {
</div>
);
}
}

LoggedInRouter.getRoutes = function() {
return (
<Route name="app" path="/" handler={LoggedInRouter}>
<DefaultRoute name="home" handler={HomePage} />
</Route>
);
}
static getRoutes = function() {
return (
<Route name="app" path="/" handler={LoggedInRouter}>
<DefaultRoute name="home" handler={HomePage} />
</Route>
);
}

}
19 changes: 9 additions & 10 deletions src/routers/logged_out.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import Router from "react-router";
let { Route, DefaultRoute, RouteHandler } = Router;
import { Route, DefaultRoute, RouteHandler } from "react-router";

import LandingPage from "../pages/landing/page";

Expand All @@ -15,12 +14,12 @@ export default class LoggedOutRouter extends React.Component {
</div>
);
}
}

LoggedOutRouter.getRoutes = function() {
return (
<Route name="app" path="/" handler={LoggedOutRouter}>
<DefaultRoute name="landing" handler={LandingPage} />
</Route>
);
}
static getRoutes = function() {
return (
<Route name="app" path="/" handler={LoggedOutRouter}>
<DefaultRoute name="landing" handler={LandingPage} />
</Route>
);
}
}
8 changes: 6 additions & 2 deletions webpack.local.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ module.exports = {
// Transform source code using Babel and React Hot Loader
module: {
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/, loaders: ["react-hot", "babel-loader"]}
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ["react-hot", "babel-loader?stage=0"],
}
]
},

// Automatically transform files with these extensions
resolve: {
extensions: ['', '.js', '.jsx']
}
}
}
4 changes: 2 additions & 2 deletions webpack.production.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ module.exports = {

module: {
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/, loader: "babel-loader" }
{ test: /\.jsx?$/, exclude: /node_modules/, loader: "babel-loader?stage=0" }
]
},

resolve: {
extensions: ['', '.js', '.jsx']
}
}
}