function user()

in js/reducers/user.js [45:78]


function user(state: State = initialState, action: Action): State {
  if (action.type === "LOGGED_IN") {
    let { id, name, sharedSchedule } = action.data;
    if (sharedSchedule === undefined) {
      sharedSchedule = null;
    }
    return {
      isLoggedIn: true,
      hasSkippedLogin: false,
      sharedSchedule,
      id,
      name
    };
  }
  if (action.type === "SKIPPED_LOGIN") {
    return {
      ...initialState,
      hasSkippedLogin: true
    };
  }
  if (action.type === "LOGGED_OUT") {
    return initialState;
  }
  if (action.type === "SET_SHARING") {
    return {
      ...state,
      sharedSchedule: action.enabled
    };
  }
  if (action.type === "RESET_NUXES") {
    return { ...state, sharedSchedule: null };
  }
  return state;
}