<commit_before>import * as osmApi from '../api/osm_api';
import * as store from '../util/localStorage';

export const login = () => (dispatch) => {
  dispatch({ type: 'USER_LOGIN_REQUEST' });

  return osmApi.login().then(
    response => {
      dispatch({
        type: 'USER_LOGIN_SUCCESS',
        response,
      });

      store.set('osmid', response.osmid);
      store.set('username', response.username);
      store.set('avatar', response.avatar);
    },
    error => dispatch({
      type: 'USER_LOGIN_FAILED',
      error: error.message || 'Failed to login.',
    })
  );<commit_msg>save to store before dispatch<commit_after>import * as osmApi from '../api/osm_api';
import * as store from '../util/localStorage';

export const login = () => (dispatch) => {
  dispatch({ type: 'USER_LOGIN_REQUEST' });

  return osmApi.login().then(
    response => {
      store.set('osmid', response.osmid);
      store.set('username', response.username);
      store.set('avatar', response.avatar);

      dispatch({
        type: 'USER_LOGIN_SUCCESS',
        response,
      });
    },
    error => dispatch({
      type: 'USER_LOGIN_FAILED',
      error: error.message || 'Failed to login.',
    })
  );
{'fraction_non_alphanumeric': 0.16777408637873753, 'fraction_numerical': 0.0, 'mean_word_length': 2.8253968253968256, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5749794', 'n_tokens_mistral': 373, 'n_tokens_neox': 366, 'n_words': 82}