hunk.code_window:       let tokenParts = BLC.words $ BL.fromStrict authzHeader
         case tokenParts of
           ["Bearer", jwt] -> return jwt
           _               -> malformedAuthzHeader
       -- see if there is a x-hasura-role header, or else pick the default role
       getCurrentRole defaultRole =
         let userRoleHeaderB = TE.encodeUtf8 userRoleHeader
             mUserRole = snd <$> find (\h -> fst h == CI.mk userRoleHeaderB) headers
  
hunk.labels: keep keep keep keep add keep keep keep keep
hunk.after_edit:     validateIsObject jVal =
         case jVal of
           A.Object x -> return x
           _          -> throw400 JWTInvalidClaims "hasura claims should be an object"
  
hunk.file_path: server/src-lib/Hasura/Server/Auth/JWT.hs
hunk.type: add
file: /* State
  
  {
    ongoingRequest : false, //true if request is going on
    lastError : null OR <string>
    lastSuccess: null OR <string>
  }
  
  */
  import defaultState from './State';
  
  const SET_USERNAME = 'PageContainer/SET_USERNAME';
  
  // HTML Component defines what state it needs
  // HTML Component should be able to emit actions
  // When an action happens, the state is modified (using the reducer function)
  // When the state is modified, anybody dependent on the state is asked to update
  // HTML Component is listening to state, hence re-renders
  
  const homeReducer = (state = defaultState, action) => {
    switch (action.type) {
      case SET_USERNAME:
        return { username: action.data };
      default:
        return state;
    }
  };
  
  const setUsername = username => ({ type: SET_USERNAME, data: username });
  
  export default homeReducer;
  export { setUsername };
  