-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6886d45
commit 3d1cd23
Showing
17 changed files
with
502 additions
and
202 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,22 @@ | ||
export const USER_LOADED = 'USER_LOADED'; | ||
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS' | ||
|
||
export function authenticateUser (user) { | ||
return{ | ||
type: USER_LOADED, | ||
user | ||
} | ||
} | ||
|
||
export function handleAuthenticateUser (user) { | ||
return (dispatch) => { | ||
|
||
} | ||
} | ||
|
||
export function loginUser (user) { | ||
return { | ||
type: LOGIN_SUCCESS, | ||
user, | ||
} | ||
} |
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,9 @@ | ||
export const GET_ERRORS = 'GET_ERRORS' | ||
export const CLEAR_ERRORS = 'CLEAR_ERRORS' | ||
|
||
export function getErrors (errors) { | ||
return { | ||
type: GET_ERRORS, | ||
errors, | ||
} | ||
} |
Empty file.
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 |
---|---|---|
|
@@ -7,7 +7,6 @@ import SignIn from './SignIn'; | |
|
||
class Main extends Component { | ||
|
||
|
||
render() { | ||
|
||
return ( | ||
|
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 |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import CssBaseline from '@material-ui/core/CssBaseline'; | ||
import { ThemeProvider } from '@material-ui/core/styles'; | ||
import App from './App'; | ||
import theme from './theme'; | ||
//Library Import | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import CssBaseline from '@material-ui/core/CssBaseline' | ||
import { ThemeProvider } from '@material-ui/core/styles' | ||
import theme from './theme' | ||
import store from './store' | ||
import { Provider } from 'react-redux' | ||
|
||
//Our Code Import | ||
import App from './App' | ||
|
||
ReactDOM.render( | ||
<ThemeProvider theme={theme}> | ||
{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} | ||
<CssBaseline /> | ||
<App /> | ||
<CssBaseline/> | ||
<Provider store={store}> | ||
<App/> | ||
</Provider> | ||
</ThemeProvider>, | ||
document.querySelector('#root'), | ||
); | ||
) |
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,8 @@ | ||
import logger from './logger'; | ||
import thunk from 'redux-thunk'; | ||
import {applyMiddleware} from 'redux'; | ||
|
||
export default applyMiddleware( | ||
thunk, | ||
logger, | ||
); |
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,11 @@ | ||
const logger = (store) => (next) => (action) => { | ||
console.group(action.type); | ||
console.log(action); | ||
const returnValue = next(action); | ||
console.log(`The new state: ${JSON.stringify(store.getState(), '', ' ')}`); | ||
console.groupEnd(); | ||
|
||
return returnValue; | ||
}; | ||
|
||
export default logger; |
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,27 @@ | ||
import { USER_LOADED } from '../actions/authActions' | ||
import { LOGIN_SUCCESS} from '../actions/userActions' | ||
|
||
const intialState = { | ||
token: localStorage.getItem('token'), | ||
isAuthenticated: null, | ||
user: null | ||
} | ||
export default function(state = intialState, action) { | ||
switch (action.type) { | ||
case USER_LOADED: | ||
return { | ||
...state, | ||
isAuthenticated: true, | ||
user: action.payload | ||
} | ||
case LOGIN_SUCCESS: | ||
return { | ||
...state, | ||
isAuthenticated: true, | ||
...action.payload | ||
} | ||
default: | ||
return state; | ||
|
||
} | ||
} |
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,13 @@ | ||
import { GET_ERRORS, CLEAR_ERRORS } from '../actions/errorActions' | ||
|
||
export default function(state = {}, action) { | ||
switch (action.type) { | ||
case GET_ERRORS: | ||
return{ | ||
msg: action.payload.msg, | ||
status: action.payload.status | ||
} | ||
default: | ||
return state | ||
} | ||
} |
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,6 @@ | ||
import { combineReducers } from 'redux' | ||
import authReducers from './authReducers' | ||
|
||
export default combineReducers({ | ||
auth: authReducers | ||
}) |
Empty file.
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,9 @@ | ||
import { createStore, compose } from 'redux' | ||
import reducers from './reducers' | ||
import middlewares from './middlewares' | ||
|
||
const store = createStore(reducers, | ||
compose(middlewares, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()), | ||
) | ||
|
||
export default store |
Empty file.