Client - refactor
This commit is contained in:
parent
b695d665d2
commit
1911b03db5
@ -68,7 +68,7 @@
|
|||||||
TStatisticsFromApi,
|
TStatisticsFromApi,
|
||||||
IStatisticsParams,
|
IStatisticsParams,
|
||||||
} from '@/types/statistics'
|
} from '@/types/statistics'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { formatStats } from '@/utils/statistics'
|
import { formatStats } from '@/utils/statistics'
|
||||||
|
|
||||||
@ -83,7 +83,7 @@
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
chartParams: {
|
chartParams: {
|
||||||
@ -140,7 +140,7 @@
|
|||||||
}
|
}
|
||||||
function getApiParams(
|
function getApiParams(
|
||||||
chartParams: IStatisticsDateParams,
|
chartParams: IStatisticsDateParams,
|
||||||
user: IAuthUserProfile
|
user: IUserProfile
|
||||||
): IStatisticsParams {
|
): IStatisticsParams {
|
||||||
return {
|
return {
|
||||||
from: format(chartParams.start, 'yyyy-MM-dd'),
|
from: format(chartParams.start, 'yyyy-MM-dd'),
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
||||||
import { WORKOUTS_STORE } from '@/store/constants'
|
import { WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkout } from '@/types/workouts'
|
import { IWorkout } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -60,7 +60,7 @@
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
import CalendarHeader from '@/components/Dashboard/UserCalendar/CalendarHeader.vue'
|
import CalendarHeader from '@/components/Dashboard/UserCalendar/CalendarHeader.vue'
|
||||||
import { WORKOUTS_STORE } from '@/store/constants'
|
import { WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkout, IWorkoutsPayload } from '@/types/workouts'
|
import { IWorkout, IWorkoutsPayload } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { getCalendarStartAndEnd } from '@/utils/dates'
|
import { getCalendarStartAndEnd } from '@/utils/dates'
|
||||||
@ -55,7 +55,7 @@
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
import StatChart from '@/components/Common/StatsChart/index.vue'
|
import StatChart from '@/components/Common/StatsChart/index.vue'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'UserMonthStats',
|
name: 'UserMonthStats',
|
||||||
@ -34,7 +34,7 @@
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
import RecordsCard from '@/components/Dashboard/UserRecords/RecordsCard.vue'
|
import RecordsCard from '@/components/Dashboard/UserRecords/RecordsCard.vue'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { getRecordsBySports } from '@/utils/records'
|
import { getRecordsBySports } from '@/utils/records'
|
||||||
import { translateSports } from '@/utils/sports'
|
import { translateSports } from '@/utils/sports'
|
||||||
|
|
||||||
@ -39,7 +39,7 @@
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import StatCard from '@/components/Common/StatCard.vue'
|
import StatCard from '@/components/Common/StatCard.vue'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'UserStatsCards',
|
name: 'UserStatsCards',
|
||||||
@ -37,7 +37,7 @@
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
import UserPicture from '@/components/User/UserPicture.vue'
|
import UserPicture from '@/components/User/UserPicture.vue'
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
||||||
import { IDropdownOption } from '@/types/forms'
|
import { IDropdownOption } from '@/types/forms'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { getApiUrl } from '@/utils'
|
import { getApiUrl } from '@/utils'
|
||||||
|
|
||||||
@ -101,7 +101,7 @@
|
|||||||
const availableLanguages = availableLocales.map((l) => {
|
const availableLanguages = availableLocales.map((l) => {
|
||||||
return { label: l.toUpperCase(), value: l }
|
return { label: l.toUpperCase(), value: l }
|
||||||
})
|
})
|
||||||
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const isAuthenticated: ComputedRef<boolean> = computed(
|
const isAuthenticated: ComputedRef<boolean> = computed(
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
import SportsMenu from '@/components/Statistics/StatsSportsMenu.vue'
|
import SportsMenu from '@/components/Statistics/StatsSportsMenu.vue'
|
||||||
import { ISport, ITranslatedSport } from '@/types/sports'
|
import { ISport, ITranslatedSport } from '@/types/sports'
|
||||||
import { IStatisticsDateParams } from '@/types/statistics'
|
import { IStatisticsDateParams } from '@/types/statistics'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { translateSports } from '@/utils/sports'
|
import { translateSports } from '@/utils/sports'
|
||||||
import { getStatsDateParams, updateChartParams } from '@/utils/statistics'
|
import { getStatsDateParams, updateChartParams } from '@/utils/statistics'
|
||||||
|
|
||||||
@ -53,7 +53,7 @@
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
import { PropType, computed, defineComponent } from 'vue'
|
import { PropType, computed, defineComponent } from 'vue'
|
||||||
|
|
||||||
import UserPicture from '@/components/User/UserPicture.vue'
|
import UserPicture from '@/components/User/UserPicture.vue'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { getApiUrl } from '@/utils'
|
import { getApiUrl } from '@/utils'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -41,7 +41,7 @@
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -29,13 +29,13 @@
|
|||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import { PropType, computed, defineComponent } from 'vue'
|
import { PropType, computed, defineComponent } from 'vue'
|
||||||
|
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'UserInfos',
|
name: 'UserInfos',
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -20,13 +20,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { PropType, computed, defineComponent } from 'vue'
|
import { PropType, computed, defineComponent } from 'vue'
|
||||||
|
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'UserPreferences',
|
name: 'UserPreferences',
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import UserHeader from '@/components/User/ProfileDisplay/UserHeader.vue'
|
import UserHeader from '@/components/User/ProfileDisplay/UserHeader.vue'
|
||||||
import UserProfileTabs from '@/components/User/UserProfileTabs.vue'
|
import UserProfileTabs from '@/components/User/UserProfileTabs.vue'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ProfileDisplay',
|
name: 'ProfileDisplay',
|
||||||
@ -23,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
tab: {
|
tab: {
|
||||||
|
@ -107,14 +107,14 @@
|
|||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
||||||
import { IAuthUserProfile, IUserPayload } from '@/types/user'
|
import { IUserProfile, IUserPayload } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'UserInfosEdition',
|
name: 'UserInfosEdition',
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -148,7 +148,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function updateUserForm(user: IAuthUserProfile) {
|
function updateUserForm(user: IUserProfile) {
|
||||||
userForm.first_name = user.first_name ? user.first_name : ''
|
userForm.first_name = user.first_name ? user.first_name : ''
|
||||||
userForm.last_name = user.last_name ? user.last_name : ''
|
userForm.last_name = user.last_name ? user.last_name : ''
|
||||||
userForm.birth_date = user.birth_date
|
userForm.birth_date = user.birth_date
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
import UserPicture from '@/components/User/UserPicture.vue'
|
import UserPicture from '@/components/User/UserPicture.vue'
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
||||||
import { TAppConfig } from '@/types/application'
|
import { TAppConfig } from '@/types/application'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { getReadableFileSize } from '@/utils/files'
|
import { getReadableFileSize } from '@/utils/files'
|
||||||
|
|
||||||
@ -51,7 +51,7 @@
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -63,14 +63,14 @@
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
||||||
import { IAuthUserProfile, IUserPreferencesPayload } from '@/types/user'
|
import { IUserProfile, IUserPreferencesPayload } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'UserPreferencesEdition',
|
name: 'UserPreferencesEdition',
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -108,7 +108,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function updateUserForm(user: IAuthUserProfile) {
|
function updateUserForm(user: IUserProfile) {
|
||||||
userForm.language = user.language ? user.language : 'en'
|
userForm.language = user.language ? user.language : 'en'
|
||||||
userForm.timezone = user.timezone ? user.timezone : 'Europe/Paris'
|
userForm.timezone = user.timezone ? user.timezone : 'Europe/Paris'
|
||||||
userForm.weekm = user.weekm ? user.weekm : false
|
userForm.weekm = user.weekm ? user.weekm : false
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
import UserProfileTabs from '@/components/User/UserProfileTabs.vue'
|
import UserProfileTabs from '@/components/User/UserProfileTabs.vue'
|
||||||
import { USER_STORE } from '@/store/constants'
|
import { USER_STORE } from '@/store/constants'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -32,7 +32,7 @@
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
tab: {
|
tab: {
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { PropType, computed, defineComponent } from 'vue'
|
import { PropType, computed, defineComponent } from 'vue'
|
||||||
|
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { getApiUrl } from '@/utils'
|
import { getApiUrl } from '@/utils'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'UserPicture',
|
name: 'UserPicture',
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
import StaticMap from '@/components/Common/StaticMap.vue'
|
import StaticMap from '@/components/Common/StaticMap.vue'
|
||||||
import { ROOT_STORE } from '@/store/constants'
|
import { ROOT_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkout } from '@/types/workouts'
|
import { IWorkout } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { getApiUrl } from '@/utils'
|
import { getApiUrl } from '@/utils'
|
||||||
@ -99,7 +99,7 @@
|
|||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
sport: {
|
sport: {
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
import { LineChart, useLineChart } from 'vue-chart-3'
|
import { LineChart, useLineChart } from 'vue-chart-3'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import {
|
import {
|
||||||
IWorkoutChartData,
|
IWorkoutChartData,
|
||||||
IWorkoutData,
|
IWorkoutData,
|
||||||
@ -57,7 +57,7 @@
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
authUser: {
|
authUser: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
workoutData: {
|
workoutData: {
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
import WorkoutMap from '@/components/Workout/WorkoutDetail/WorkoutMap.vue'
|
import WorkoutMap from '@/components/Workout/WorkoutDetail/WorkoutMap.vue'
|
||||||
import { WORKOUTS_STORE } from '@/store/constants'
|
import { WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import {
|
import {
|
||||||
IWorkout,
|
IWorkout,
|
||||||
IWorkoutData,
|
IWorkoutData,
|
||||||
@ -63,7 +63,7 @@
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
authUser: {
|
authUser: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
displaySegment: {
|
displaySegment: {
|
||||||
|
@ -222,7 +222,7 @@
|
|||||||
import { ROOT_STORE, WORKOUTS_STORE } from '@/store/constants'
|
import { ROOT_STORE, WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { TAppConfig } from '@/types/application'
|
import { TAppConfig } from '@/types/application'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkout, IWorkoutForm } from '@/types/workouts'
|
import { IWorkout, IWorkoutForm } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { formatWorkoutDate, getDateWithTZ } from '@/utils/dates'
|
import { formatWorkoutDate, getDateWithTZ } from '@/utils/dates'
|
||||||
@ -233,7 +233,7 @@
|
|||||||
name: 'WorkoutEdition',
|
name: 'WorkoutEdition',
|
||||||
props: {
|
props: {
|
||||||
authUser: {
|
authUser: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
isCreation: {
|
isCreation: {
|
||||||
|
@ -139,14 +139,14 @@
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { translateSports } from '@/utils/sports'
|
import { translateSports } from '@/utils/sports'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'WorkoutsFilters',
|
name: 'WorkoutsFilters',
|
||||||
props: {
|
props: {
|
||||||
authUser: {
|
authUser: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
sports: {
|
sports: {
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
||||||
import { WORKOUTS_STORE } from '@/store/constants'
|
import { WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { ITranslatedSport } from '@/types/sports'
|
import { ITranslatedSport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkout } from '@/types/workouts'
|
import { IWorkout } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { getDateWithTZ } from '@/utils/dates'
|
import { getDateWithTZ } from '@/utils/dates'
|
||||||
@ -135,7 +135,7 @@
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IAuthUserProfile>,
|
type: Object as PropType<IUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
sports: {
|
sports: {
|
||||||
|
@ -2,12 +2,12 @@ import { MutationTree } from 'vuex'
|
|||||||
|
|
||||||
import { USER_STORE } from '@/store/constants'
|
import { USER_STORE } from '@/store/constants'
|
||||||
import { IUserState, TUserMutations } from '@/store/modules/user/types'
|
import { IUserState, TUserMutations } from '@/store/modules/user/types'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export const mutations: MutationTree<IUserState> & TUserMutations = {
|
export const mutations: MutationTree<IUserState> & TUserMutations = {
|
||||||
[USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: IUserState) {
|
[USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: IUserState) {
|
||||||
state.authToken = null
|
state.authToken = null
|
||||||
state.authUserProfile = <IAuthUserProfile>{}
|
state.authUserProfile = <IUserProfile>{}
|
||||||
},
|
},
|
||||||
[USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](
|
[USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](
|
||||||
state: IUserState,
|
state: IUserState,
|
||||||
@ -17,7 +17,7 @@ export const mutations: MutationTree<IUserState> & TUserMutations = {
|
|||||||
},
|
},
|
||||||
[USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
[USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
||||||
state: IUserState,
|
state: IUserState,
|
||||||
authUserProfile: IAuthUserProfile
|
authUserProfile: IUserProfile
|
||||||
) {
|
) {
|
||||||
state.authUserProfile = authUserProfile
|
state.authUserProfile = authUserProfile
|
||||||
},
|
},
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { IUserState } from '@/store/modules/user/types'
|
import { IUserState } from '@/store/modules/user/types'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export const userState: IUserState = {
|
export const userState: IUserState = {
|
||||||
authToken: null,
|
authToken: null,
|
||||||
authUserProfile: <IAuthUserProfile>{},
|
authUserProfile: <IUserProfile>{},
|
||||||
loading: false,
|
loading: false,
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
import { USER_STORE } from '@/store/constants'
|
import { USER_STORE } from '@/store/constants'
|
||||||
import { IRootState } from '@/store/modules/root/types'
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
import {
|
import {
|
||||||
IAuthUserProfile,
|
IUserProfile,
|
||||||
ILoginOrRegisterData,
|
ILoginOrRegisterData,
|
||||||
IUserDeletionPayload,
|
IUserDeletionPayload,
|
||||||
IUserPasswordPayload,
|
IUserPasswordPayload,
|
||||||
@ -20,7 +20,7 @@ import {
|
|||||||
|
|
||||||
export interface IUserState {
|
export interface IUserState {
|
||||||
authToken: string | null
|
authToken: string | null
|
||||||
authUserProfile: IAuthUserProfile
|
authUserProfile: IUserProfile
|
||||||
loading: boolean
|
loading: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ export interface IUserActions {
|
|||||||
export interface IUserGetters {
|
export interface IUserGetters {
|
||||||
[USER_STORE.GETTERS.AUTH_TOKEN](state: IUserState): string | null
|
[USER_STORE.GETTERS.AUTH_TOKEN](state: IUserState): string | null
|
||||||
|
|
||||||
[USER_STORE.GETTERS.AUTH_USER_PROFILE](state: IUserState): IAuthUserProfile
|
[USER_STORE.GETTERS.AUTH_USER_PROFILE](state: IUserState): IUserProfile
|
||||||
|
|
||||||
[USER_STORE.GETTERS.IS_ADMIN](state: IUserState): boolean
|
[USER_STORE.GETTERS.IS_ADMIN](state: IUserState): boolean
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ export type TUserMutations<S = IUserState> = {
|
|||||||
[USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](state: S, authToken: string): void
|
[USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](state: S, authToken: string): void
|
||||||
[USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
[USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
||||||
state: S,
|
state: S,
|
||||||
authUserProfile: IAuthUserProfile
|
authUserProfile: IUserProfile
|
||||||
): void
|
): void
|
||||||
[USER_STORE.MUTATIONS.UPDATE_USER_LOADING](state: S, loading: boolean): void
|
[USER_STORE.MUTATIONS.UPDATE_USER_LOADING](state: S, loading: boolean): void
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { IRecord } from '@/types/workouts'
|
import { IRecord } from '@/types/workouts'
|
||||||
|
|
||||||
export interface IAuthUserProfile {
|
export interface IUserProfile {
|
||||||
admin: boolean
|
admin: boolean
|
||||||
bio: string | null
|
bio: string | null
|
||||||
birth_date: string | null
|
birth_date: string | null
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
import UserStatsCards from '@/components/Dashboard/UserStatsCards/index.vue'
|
import UserStatsCards from '@/components/Dashboard/UserStatsCards/index.vue'
|
||||||
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -99,7 +99,7 @@
|
|||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
import { computed, ComputedRef, defineComponent } from 'vue'
|
import { computed, ComputedRef, defineComponent } from 'vue'
|
||||||
|
|
||||||
import { USER_STORE } from '@/store/constants'
|
import { USER_STORE } from '@/store/constants'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ProfileView',
|
name: 'ProfileView',
|
||||||
setup() {
|
setup() {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
return { authUser }
|
return { authUser }
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
||||||
import { USER_STORE, SPORTS_STORE } from '@/store/constants'
|
import { USER_STORE, SPORTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(() =>
|
const sports: ComputedRef<ISport[]> = computed(() =>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import WorkoutEdition from '@/components/Workout/WorkoutEdition.vue'
|
import WorkoutEdition from '@/components/Workout/WorkoutEdition.vue'
|
||||||
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkoutData } from '@/types/workouts'
|
import { IWorkoutData } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
||||||
)
|
)
|
||||||
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const workoutData: ComputedRef<IWorkoutData> = computed(
|
const workoutData: ComputedRef<IWorkoutData> = computed(
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
import WorkoutEdition from '@/components/Workout/WorkoutEdition.vue'
|
import WorkoutEdition from '@/components/Workout/WorkoutEdition.vue'
|
||||||
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkoutData } from '@/types/workouts'
|
import { IWorkoutData } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -43,7 +43,7 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
import WorkoutSegments from '@/components/Workout/WorkoutSegments.vue'
|
import WorkoutSegments from '@/components/Workout/WorkoutSegments.vue'
|
||||||
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { IWorkoutData, IWorkoutPayload, TCoordinates } from '@/types/workouts'
|
import { IWorkoutData, IWorkoutPayload, TCoordinates } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -91,7 +91,7 @@
|
|||||||
const workoutData: ComputedRef<IWorkoutData> = computed(
|
const workoutData: ComputedRef<IWorkoutData> = computed(
|
||||||
() => store.getters[WORKOUTS_STORE.GETTERS.WORKOUT_DATA]
|
() => store.getters[WORKOUTS_STORE.GETTERS.WORKOUT_DATA]
|
||||||
)
|
)
|
||||||
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
import WorkoutsList from '@/components/Workouts/WorkoutsList.vue'
|
import WorkoutsList from '@/components/Workouts/WorkoutsList.vue'
|
||||||
import { USER_STORE, SPORTS_STORE } from '@/store/constants'
|
import { USER_STORE, SPORTS_STORE } from '@/store/constants'
|
||||||
import { ISport, ITranslatedSport } from '@/types/sports'
|
import { ISport, ITranslatedSport } from '@/types/sports'
|
||||||
import { IAuthUserProfile } from '@/types/user'
|
import { IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { translateSports } from '@/utils/sports'
|
import { translateSports } from '@/utils/sports'
|
||||||
|
|
||||||
@ -51,7 +51,7 @@
|
|||||||
setup() {
|
setup() {
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
const authUser: ComputedRef<IUserProfile> = computed(
|
||||||
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
|
Loading…
Reference in New Issue
Block a user