Client - minor refactor

This commit is contained in:
Sam 2019-08-28 15:51:04 +02:00
parent 2a52b9081d
commit 8000018cf4
3 changed files with 23 additions and 33 deletions

View File

@ -28,7 +28,7 @@ export default function ActivityCard(props) {
<img
alt="Map"
src={
`${apiUrl}activities/map/${activity.map}` + `?${Date.now()}`
`${apiUrl}activities/map/${activity.map}?${Date.now()}`
}
className="img-fluid"
/>

View File

@ -115,7 +115,7 @@ class NavBar extends React.PureComponent {
{picture === true && (
<img
alt="Avatar"
src={`${apiUrl}users/${id}/picture` + `?${Date.now()}`}
src={`${apiUrl}users/${id}/picture?${Date.now()}`}
className="img-fluid App-nav-profile-img"
/>
)}

View File

@ -7,15 +7,13 @@ const handleDataAndError = (state, type, action) => {
if (action.target !== type) {
return state
}
switch (action.type) {
case 'SET_DATA':
if (action.type === 'SET_DATA') {
return {
...state,
data: action.data[action.target],
}
default:
return state
}
return state
}
const activities = (state = initial.activities, action) => {
@ -36,42 +34,34 @@ const activities = (state = initial.activities, action) => {
}
const calendarActivities = (state = initial.calendarActivities, action) => {
switch (action.type) {
case 'UPDATE_CALENDAR':
if (action.type === 'UPDATE_CALENDAR') {
return {
...state,
data: action.activities,
}
default:
return handleDataAndError(state, 'calendarActivities', action)
}
return handleDataAndError(state, 'calendarActivities', action)
}
const chartData = (state = initial.chartData, action) => {
switch (action.type) {
case 'SET_CHART_DATA':
if (action.type === 'SET_CHART_DATA') {
return action.chartData
default:
return state
}
return state
}
const gpx = (state = initial.gpx, action) => {
switch (action.type) {
case 'SET_GPX':
if (action.type === 'SET_GPX') {
return action.gpxContent
default:
return state
}
return state
}
const loading = (state = initial.loading, action) => {
switch (action.type) {
case 'SET_LOADING':
if (action.type === 'SET_LOADING') {
return action.loading
default:
return state
}
return state
}
const message = (state = initial.message, action) => {