<commit_before>import { Reducer } from 'redux';
import * as Cookies from 'js-cookie';

import { TokenAction, actionTypes } from '../actions/token';
import { TokenStateSchema, TokenEmptyState } from '../models/token';

export const tokenReducer: Reducer<TokenStateSchema> =
  (state: TokenStateSchema = TokenEmptyState, action: TokenAction) => {

    switch (action.type) {
      case actionTypes.RECEIVE_TOKEN:
        Cookies.set('token', action.token.token);
        Cookies.set('user', action.username);
        return {
          ...state,
          user: action.username,
          token: action.token.token
        };
      case actionTypes.DISCARD_TOKEN:
        Cookies.remove('token');
        Cookies.remove('user');
        return {
          ...state,
          user: '',
          token: ''
        };
      default:
        return state;
    }
  };<commit_msg>Update reducer to not alter cookie states<commit_after>import { Reducer } from 'redux';
import * as Cookies from 'js-cookie';

import { TokenAction, actionTypes } from '../actions/token';
import { TokenStateSchema, TokenEmptyState } from '../models/token';

export const tokenReducer: Reducer<TokenStateSchema> =
  (state: TokenStateSchema = TokenEmptyState, action: TokenAction) => {

    switch (action.type) {
      case actionTypes.RECEIVE_TOKEN:
        // Cookies.set('token', action.token.token);
        // Cookies.set('user', action.username);
        return {
          ...state,
          user: action.username,
          token: action.token.token
        };
      case actionTypes.DISCARD_TOKEN:
        // Cookies.remove('token');
        // Cookies.remove('user');
        // Cookies.remove('sessionid');
        return {
          ...state,
          user: '',
          token: ''
        };
      default:
        return state;
    }
  };
{'fraction_non_alphanumeric': 0.13457330415754923, 'fraction_numerical': 0.0, 'mean_word_length': 2.2544483985765122, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4123459', 'n_tokens_mistral': 519, 'n_tokens_neox': 507, 'n_words': 113}