Commit 1109360b authored by Sam Galson's avatar Sam Galson

add prettier config and minor refactor

parent 2bdca5ca
......@@ -2,6 +2,9 @@
"extends": [
"standard",
"plugin:react/recommended"
"prettier",
"prettier/standard",
"prettier/react",
],
"parserOptions": {
"ecmaFeatures": {
......@@ -12,9 +15,6 @@
"env": {
"browser": true
},
"plugins": [
"react"
],
"globals": {
"PUBSWEET_COMPONENTS": true
}
......
{
"singleQuote": true,
"semi": false,
"printWidth": 100,
"trailingComma": "all"
}
language: node_js
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
before_install:
- export JOBS=max
node_js:
- "4.0"
- "4"
- "5"
- "stable"
sudo: false
......@@ -9,18 +9,22 @@
"testci": "gitlab-ci-multi-runner exec docker test"
},
"engines": {
"node": ">=7.7.0",
"npm": ">=3.0.0"
"node": ">=8.6.0",
"npm": ">=5.0.0"
},
"author": "Collaborative Knowledge Foundation",
"license": "MIT",
"dependencies": {
"authsome": "0.0.9",
"config": "^1.21.0",
"eslint-config-prettier": "^2.6.0",
"event-source-polyfill": "^0.0.10",
"global": "^4.3.1",
"husky": "^0.14.3",
"isomorphic-fetch": "^2.1.1",
"lint-staged": "^4.2.3",
"lodash": "^4.0.0",
"prettier": "^1.7.4",
"prop-types": "^15.5.8",
"pubsweet-component-login": "^0.5.2",
"react": "^15.4.4",
......
......@@ -2,14 +2,13 @@ import React from 'react'
import { connect } from 'react-redux'
import { withRouter } from 'react-router'
import { push } from 'react-router-redux'
import { bindActionCreators } from 'redux'
import PropTypes from 'prop-types'
import actions from '../actions'
export class AuthenticatedComponent extends React.Component {
componentWillMount () {
this.props.actions.getCurrentUser().then(
this.props.getCurrentUser().then(
() => this.checkAuth(this.props)
)
}
......@@ -33,7 +32,7 @@ export class AuthenticatedComponent extends React.Component {
AuthenticatedComponent.propTypes = {
children: PropTypes.node,
location: PropTypes.object,
actions: PropTypes.object.isRequired,
getCurrentUser: PropTypes.func.isRequired,
isFetching: PropTypes.bool,
isAuthenticated: PropTypes.bool,
pushState: PropTypes.func.isRequired
......@@ -46,13 +45,6 @@ function mapState (state) {
}
}
function mapDispatch (dispatch) {
return {
pushState: bindActionCreators(push, dispatch),
actions: bindActionCreators(actions, dispatch)
}
}
const ConnectedAuthenticatedComponent = withRouter(connect(mapState, mapDispatch)(AuthenticatedComponent))
const ConnectedAuthenticatedComponent = withRouter(connect(mapState, {getCurrentUser: actions.getCurrentUser, pushState: push})(AuthenticatedComponent))
export default ConnectedAuthenticatedComponent
......@@ -7,9 +7,7 @@ const { AuthenticatedComponent } = require('../../src/components/AuthenticatedCo
function makeWrapper (props = {}) {
return shallow(<AuthenticatedComponent
actions={{
getCurrentUser: () => Promise.resolve()
}}
getCurrentUser={() => Promise.resolve()}
pushState={jest.fn()}
location={{}}
{...props}>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment