porkchopclub/porkchop

View on GitHub
app/javascript/reducers/ongoingMatch.js

Summary

Maintainability
A
0 mins
Test Coverage
import { handleActions } from 'redux-actions'

import {
  ongoingMatchUpdated,
  clockTick
} from '../actions/ongoingMatch'

export default handleActions({
  [ongoingMatchUpdated]: (state, action) => action.payload,
  [clockTick]: (state, action) => {
    if (state === null) { return null }
    return { ...state, seconds_old: state.seconds_old + 1 }
  }
}, null)