Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix save profile ui bug #194

Merged
merged 2 commits into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/actions/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ import * as firebase from 'firebase'
import FetchClient from './../utils/fetchClient'
import actionCreator from './../utils/actionCreator'
import * as Constants from './../constants'
import { setUser } from './user'

export function setAccessToken(token) {
return actionCreator(Constants.SET_AUTH_TOKEN, { token })
}

export function setUser(user) {
return actionCreator(Constants.SET_USER, { user })
}

export function setPreviousRoute(previousRoute) {
return actionCreator(Constants.SET_PREVIOUS_ROUTE, { previousRoute })
}
Expand Down
9 changes: 8 additions & 1 deletion src/actions/user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/* eslint import/prefer-default-export: 0 */
import FetchClient from '../utils/fetchClient'
import actionCreator from '../utils/actionCreator'
import * as Constants from '../constants'

export function setUser(user) {
return actionCreator(Constants.SET_USER, { user })
}

export function getUser(token, user) {
return async () => {
Expand All @@ -22,7 +28,7 @@ export function getUser(token, user) {
}

export function updateUser(token, userId, user) {
return async () => {
return async (dispatch) => {
try {
const fetchClient = new FetchClient()
fetchClient.setAuthToken(token)
Expand All @@ -31,6 +37,7 @@ export function updateUser(token, userId, user) {
body: user
})
if (result) {
dispatch(setUser(result))
return { result, error }
}
console.error(error)
Expand Down
1 change: 0 additions & 1 deletion src/containers/UserSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const tabValues = ['profile', 'invites', 'accounts', 'notification']

const mapStateToProps = state => ({
session: state.session,
user: state.user,
invites: state.invites
})

Expand Down