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
gem install bcrypt | |
gem install rack-cors |
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import App from './App'; | |
ReactDOM.render( | |
<App />, | |
document.getElementById('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
App.js | |
index.js | |
src | |
-Redux_ | |
| | |
-actions | |
-<empty> | |
| | |
-reducers | |
| |
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
import { createStore, combineReducers, compose, applyMiddleware } from 'redux' | |
import thunk from 'redux-thunk' | |
const rootReducer = combineReducers({ | |
\*leave empty for now*\ | |
}) | |
const middleware = [thunk, reduxLogger] | |
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; |
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
const authReducer = ( | |
state = { | |
loggedIn : false, | |
currentUser : {}, | |
}, | |
action, | |
) => { | |
switch (action.type) { | |
case 'AUTH_SUCCESS': | |
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
const authReducer = ( | |
state = { | |
loggedIn: false, | |
currentUser: {}, | |
}, | |
action, | |
) => { | |
switch (action.type) { | |
case 'AUTH_SUCCESS': | |
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
export const signup = (user) => { | |
return (dispatch) => { | |
fetch(`${apiUrl}/users`, { | |
// will set this up in the future | |
method: 'POST', | |
headers: { 'Content-Type': 'application/json' }, | |
credentials: 'include', | |
body: JSON.stringify({ user: user }), | |
}) | |
.then((res) => res.json()) |
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import App from './App'; | |
import { Provider } from 'react-redux'; | |
import store from './Redux' | |
ReactDOM.render( | |
<Provider store={store}> | |
<App /> |
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
Rails.application.config.middleware.insert_before 0, Rack::Cors do | |
allow do | |
origins 'http://localhost:3000' | |
resource '*', | |
headers: :any, | |
methods: [:get, :post, :put, :patch, :delete, :options, :head], | |
credentials: true // absoultly remember to set this in to true, and in your ajax to set credentials: 'include' | |
end |
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
Rails.application.config.middleware.insert_before 0, Rack::Cors do | |
allow do | |
origins 'http://localhost:3000' | |
resource '*', | |
headers: :any, | |
methods: [:get, :post, :put, :patch, :delete, :options, :head], | |
credentials: true | |
# absoultly remember to set this in to true, and in your ajax to set credentials: 'include' | |
end |