<commit_before>import { Action, ActionReducer } from '@ngrx/store';

import { isType } from 'typescript-fsa';

import { environment } from '../../../environments/environment';
import { login, loginSuccess, loginRedirect, logout } from '../actions';
import { AuthState, State } from '../state';

const initialState = {
  config: environment.auth,
};

export function loginReducer(state: AuthState = initialState, action: Action) {
  if (isType(action, login)) {
    return { ...state, fromUrl: action.payload };
  }
  if (isType(action, loginSuccess)) {
    return { ...state, token: action.payload };
  }
  if (isType(action, loginRedirect)) {
    return { ...state, fromUrl: undefined };
  }
  return state;
};

export function logoutReducer(reducer: ActionReducer<any>) {
  return (state: State, action: Action) => {
    if (isType(action, logout)) {
      state = undefined;
    }
    return reducer(state, action);
  };
}<commit_msg>Copy environment config to initial state of authReducer<commit_after>import { Action, ActionReducer } from '@ngrx/store';

import { isType } from 'typescript-fsa';

import { environment } from '../../../environments/environment';
import { login, loginSuccess, loginRedirect, logout } from '../actions';
import { AuthState, State } from '../state';

const initialState = {
  config: { ...environment.auth },
};

export function loginReducer(state: AuthState = initialState, action: Action) {
  if (isType(action, login)) {
    return { ...state, fromUrl: action.payload };
  }
  if (isType(action, loginSuccess)) {
    return { ...state, token: action.payload };
  }
  if (isType(action, loginRedirect)) {
    return { ...state, fromUrl: undefined };
  }
  return state;
};

export function logoutReducer(reducer: ActionReducer<any>) {
  return (state: State, action: Action) => {
    if (isType(action, logout)) {
      state = undefined;
    }
    return reducer(state, action);
  };
}
{'fraction_non_alphanumeric': 0.1544461778471139, 'fraction_numerical': 0.0, 'mean_word_length': 3.7506172839506173, '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': '6414119', 'n_tokens_mistral': 587, 'n_tokens_neox': 580, 'n_words': 159}