-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from mtrifilo/upgrade-dependencies
Upgrade dependencies for v2.0.0
- Loading branch information
Showing
32 changed files
with
3,013 additions
and
2,008 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ data/* | |
config.json | ||
public/* | ||
!public/.gitkeep | ||
.vscode/* | ||
.vscode | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
- "8" | ||
env: | ||
- CXX=g++-4.8 | ||
addons: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const axios = require('axios') | ||
|
||
const setTokenToHeaders = require('../../auth/setTokenToHeaders') | ||
|
||
afterEach(() => { | ||
if (axios.defaults.headers.common['Authorization']) { | ||
delete axios.defaults.headers.common['Authorization'] | ||
} | ||
}) | ||
|
||
test('with token: should set Authorization header with the token', () => { | ||
setTokenToHeaders('testToken') | ||
expect(axios.defaults.headers.common['Authorization']).toBe('Bearer testToken') | ||
}) | ||
|
||
test('without token: should delete token if present', () => { | ||
axios.defaults.headers.common['Authorization'] = 'testToken' | ||
setTokenToHeaders() | ||
expect(axios.defaults.headers.common['Authorization']).toBeUndefined() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React, { Component } from 'react' | ||
import { connect } from 'react-redux' | ||
import { Redirect } from 'react-router' | ||
import { array, bool } from 'prop-types' | ||
|
||
class ShowIfLoggedOut extends Component { | ||
render () { | ||
if (this.props.isAuthenticated) { | ||
return <Redirect to='/' /> | ||
} | ||
|
||
if (this.props.isAuthenticated !== false) { | ||
return null | ||
} | ||
|
||
return <div>{this.props.children}</div> | ||
} | ||
} | ||
|
||
ShowIfLoggedOut.propTypes = { | ||
children: array.isRequired, | ||
isAuthenticated: bool.isRequired | ||
} | ||
|
||
const mapStateToProps = state => { | ||
return { | ||
isAuthenticated: state.user.isAuthenticated | ||
} | ||
} | ||
|
||
export default connect(mapStateToProps)(ShowIfLoggedOut) |
Oops, something went wrong.