@@ -3,7 +3,7 @@ import { format } from 'date-fns';
33import React , { useContext , useEffect , useState } from 'react' ;
44import { useHistory } from 'react-router-dom' ;
55import { Button , Checkbox , Typography } from '@mui/material' ;
6- import { downloadData , initiate } from '../api/generic.js' ;
6+ import { initiate } from '../api/generic.js' ;
77import Pulse from '../components/pulse/Pulse.jsx' ;
88import { AppContext } from '../context/AppContext' ;
99import { selectCsrfToken , selectCurrentUser } from '../context/selectors' ;
@@ -54,39 +54,6 @@ const PulsePage = () => {
5454 center : pulse . externalScore - 1 ) ;
5555 } , [ pulse ] ) ;
5656
57- const loadTodayPulse = async ( ) => {
58- if ( ! csrf || ! currentUser ?. id ) return ;
59-
60- const query = {
61- dateFrom : today ,
62- dateTo : today ,
63- teamMemberId : currentUser . id
64- } ;
65-
66- const res = await downloadData ( pulseURL , csrf , query ) ;
67- if ( res . error ) return ;
68-
69- // Sort pulse responses by date, latest to earliest
70- const pulses = res . payload . data ?. sort ( ( a , b ) => {
71- const l = a . submissionDate ;
72- const r = b . submissionDate ;
73- if ( r [ 0 ] == l [ 0 ] ) {
74- if ( r [ 1 ] == l [ 1 ] ) {
75- return r [ 2 ] - l [ 2 ] ;
76- } else {
77- return r [ 1 ] - l [ 1 ] ;
78- }
79- } else {
80- return r [ 0 ] - l [ 0 ] ;
81- }
82- } ) ;
83- setPulse ( pulses . at ( 0 ) ) ;
84- } ;
85-
86- useEffect ( ( ) => {
87- loadTodayPulse ( ) ;
88- } , [ csrf , currentUser ] ) ;
89-
9057 const submit = async ( ) => {
9158 const myId = currentUser ?. id ;
9259 const data = {
0 commit comments