Skip to content

Commit

Permalink
fix(user-mgmt): if datatools permissions not found, set error message
Browse files Browse the repository at this point in the history
  • Loading branch information
landonreed committed Jun 21, 2017
1 parent 3b79c2e commit 3340197
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/manager/actions/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { secureFetch } from '../../common/actions'
import objectPath from 'object-path'

import {setErrorMessage} from './status'
import {secureFetch} from '../../common/actions'

export function checkingExistingLogin (loginProps) {
return {
type: 'CHECKING_EXISTING_LOGIN',
Expand Down Expand Up @@ -144,13 +146,13 @@ export function unsubscribeAll (profile) {
export function updateUserData (user, userData) {
return function (dispatch, getState) {
var dtIndex = user.profile ? user.profile.app_metadata.datatools.findIndex(dt => dt.client_id === process.env.AUTH0_CLIENT_ID) : user.app_metadata.datatools.findIndex(dt => dt.client_id === process.env.AUTH0_CLIENT_ID)
console.log(dtIndex)
var datatools = user.profile ? user.profile.app_metadata.datatools : user.app_metadata.datatools
if (dtIndex === -1) {
return dispatch(setErrorMessage(`Could not find user metadata\n${JSON.stringify(user)}`))
}
for (var type in userData) {
datatools[dtIndex][type] = userData[type]
}
console.log(userData)
console.log(datatools)
var payload = {
user_id: user.user_id,
data: datatools
Expand Down

0 comments on commit 3340197

Please sign in to comment.