Client - refactoring workouts (WIP)

separate user workouts from timeline workouts
This commit is contained in:
Sam
2021-11-02 14:02:18 +01:00
parent 288a78e2a0
commit 37596f52f4
8 changed files with 45 additions and 44 deletions

View File

@ -92,11 +92,6 @@
</div>
</div>
<NoWorkouts v-if="workouts.length === 0" />
<div v-if="moreWorkoutsExist" class="more-workouts">
<button @click="loadMoreWorkouts">
{{ $t('workouts.LOAD_MORE_WORKOUT') }}
</button>
</div>
<div id="bottom" />
</div>
</template>
@ -150,11 +145,6 @@
)
const per_page = 10
const page = ref(1)
const moreWorkoutsExist: ComputedRef<boolean> = computed(() =>
workouts.value.length > 0
? workouts.value[workouts.value.length - 1].previous_workout !== null
: false
)
onBeforeMount(() => {
loadWorkouts()
@ -169,15 +159,6 @@
...props.params,
})
}
function loadMoreWorkouts() {
page.value += 1
store.dispatch(WORKOUTS_STORE.ACTIONS.GET_MORE_USER_WORKOUTS, {
page: page.value,
per_page,
...defaultOrder,
...props.params,
})
}
watch(
() => props.params,
@ -187,12 +168,10 @@
)
return {
moreWorkoutsExist,
workouts,
capitalize,
format,
getDateWithTZ,
loadMoreWorkouts,
}
},
})