Cleanup
This commit is contained in:
parent
ba8febd107
commit
7601d3f5a1
@ -31,8 +31,7 @@ export function loginUser(credentials) {
|
||||
const backend = currentBackend(state.config);
|
||||
|
||||
dispatch(authenticating());
|
||||
backend.authenticate(credentials)
|
||||
.then((user) => dispatch(authenticate(user)))
|
||||
//.catch((err) => dispatch(authError(err)));
|
||||
return backend.authenticate(credentials)
|
||||
.then((user) => dispatch(authenticate(user)));
|
||||
};
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ export default class EntryEditor extends React.Component {
|
||||
}
|
||||
|
||||
handleChange(entry) {
|
||||
console.log('Got new entry: %o', entry.toObject());
|
||||
this.setState({entry: entry});
|
||||
}
|
||||
|
||||
@ -28,6 +27,6 @@ export default class EntryEditor extends React.Component {
|
||||
<PreviewPane collection={collection} entry={this.state.entry}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
|
@ -5,18 +5,10 @@ import { loginUser } from '../actions/auth';
|
||||
import { currentBackend } from '../backends/backend';
|
||||
|
||||
class App extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.props.dispatch(loadConfig());
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
//this.props.dispatch(loadBackend());
|
||||
}
|
||||
|
||||
configError(config) {
|
||||
return <div>
|
||||
<h1>Error loading the CMS configuration</h1>
|
||||
@ -81,13 +73,10 @@ class App extends React.Component {
|
||||
}
|
||||
|
||||
function mapStateToProps(state) {
|
||||
const { auth } = state;
|
||||
const { auth, config } = state;
|
||||
const user = auth && auth.get('user');
|
||||
|
||||
return {
|
||||
auth: auth,
|
||||
user: auth && auth.get('user'),
|
||||
config: state.config
|
||||
};
|
||||
return {auth, config, user};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(App);
|
||||
|
@ -21,7 +21,7 @@ class DashboardPage extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { collections, collection, slug, children } = this.props;
|
||||
const { collections, collection } = this.props;
|
||||
|
||||
if (collections == null) {
|
||||
return <h1>No collections defined in your config.yml</h1>;
|
||||
@ -48,12 +48,9 @@ class DashboardPage extends React.Component {
|
||||
function mapStateToProps(state, ownProps) {
|
||||
const { collections } = state;
|
||||
const { name, slug } = ownProps.params;
|
||||
const collection = name ? collections.get(name) : collections.first();
|
||||
|
||||
return {
|
||||
slug: slug,
|
||||
collection: name ? collections.get(name) : collections.first(),
|
||||
collections: collections
|
||||
};
|
||||
return {slug, collection, collections};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(DashboardPage);
|
||||
|
@ -4,12 +4,6 @@ import { Map } from 'immutable';
|
||||
import EntryEditor from '../components/EntryEditor';
|
||||
|
||||
class EntryPage extends React.Component {
|
||||
componentDidMount() {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { collection, entry } = this.props;
|
||||
|
||||
@ -18,13 +12,10 @@ class EntryPage extends React.Component {
|
||||
}
|
||||
|
||||
function mapStateToProps(state, ownProps) {
|
||||
const { collections } = state;
|
||||
const { collections, media } = state;
|
||||
const collection = collections.get(ownProps.params.name);
|
||||
|
||||
return {
|
||||
collection: collection,
|
||||
collections: collections
|
||||
};
|
||||
return {media, collection, collections};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(EntryPage);
|
||||
|
Loading…
x
Reference in New Issue
Block a user