Skip to content
Snippets Groups Projects
statistics.ts 516 B
Newer Older
  • Learn to ignore specific revisions
  • This file handles actions for the statistics redux state
    */
    
    
    import axios from 'axios'
    import { AppDispatch } from './../store'
    import Types from './types'
    
    
    /**  Get all statistics and dispatch actions to save them to statistics state */
    
    export const getStatistics = () => async (dispatch: AppDispatch) => {
      await axios
        .get('/api/misc/statistics')
        .then((res) => {
          dispatch({
            type: Types.SET_STATISTICS,
            payload: res.data,
          })
        })
        .catch((err) => console.log(err))
    }