Client - update user typing
This commit is contained in:
parent
ac6aceadfd
commit
0b1d99aa7a
@ -133,7 +133,7 @@
|
|||||||
import UserPicture from '@/components/User/UserPicture.vue'
|
import UserPicture from '@/components/User/UserPicture.vue'
|
||||||
import { AUTH_USER_STORE, ROOT_STORE, USERS_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE, USERS_STORE } from '@/store/constants'
|
||||||
import { IPagination, TPaginationPayload } from '@/types/api'
|
import { IPagination, TPaginationPayload } from '@/types/api'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile, IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { getQuery, sortList } from '@/utils/api'
|
import { getQuery, sortList } from '@/utils/api'
|
||||||
import { getDateWithTZ } from '@/utils/dates'
|
import { getDateWithTZ } from '@/utils/dates'
|
||||||
@ -152,7 +152,7 @@
|
|||||||
let query: TPaginationPayload = reactive(
|
let query: TPaginationPayload = reactive(
|
||||||
getQuery(route.query, orderByList, defaultOrderBy)
|
getQuery(route.query, orderByList, defaultOrderBy)
|
||||||
)
|
)
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const users: ComputedRef<IUserProfile[]> = computed(
|
const users: ComputedRef<IUserProfile[]> = computed(
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
TStatisticsFromApi,
|
TStatisticsFromApi,
|
||||||
IStatisticsParams,
|
IStatisticsParams,
|
||||||
} from '@/types/statistics'
|
} from '@/types/statistics'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { formatStats } from '@/utils/statistics'
|
import { formatStats } from '@/utils/statistics'
|
||||||
|
|
||||||
@ -111,7 +111,7 @@
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: Object as PropType<IUserProfile>,
|
type: Object as PropType<IAuthUserProfile>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
chartParams: {
|
chartParams: {
|
||||||
@ -169,7 +169,7 @@
|
|||||||
}
|
}
|
||||||
function getApiParams(
|
function getApiParams(
|
||||||
chartParams: IStatisticsDateParams,
|
chartParams: IStatisticsDateParams,
|
||||||
user: IUserProfile
|
user: IAuthUserProfile
|
||||||
): IStatisticsParams {
|
): IStatisticsParams {
|
||||||
return {
|
return {
|
||||||
from: format(chartParams.start, 'yyyy-MM-dd'),
|
from: format(chartParams.start, 'yyyy-MM-dd'),
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
import UserPicture from '@/components/User/UserPicture.vue'
|
import UserPicture from '@/components/User/UserPicture.vue'
|
||||||
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
||||||
import { IDropdownOption } from '@/types/forms'
|
import { IDropdownOption } from '@/types/forms'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { availableLanguages } from '@/utils/locales'
|
import { availableLanguages } from '@/utils/locales'
|
||||||
|
|
||||||
@ -93,7 +93,7 @@
|
|||||||
const { locale } = useI18n()
|
const { locale } = useI18n()
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const isAuthenticated: ComputedRef<boolean> = computed(
|
const isAuthenticated: ComputedRef<boolean> = computed(
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
import { ComputedRef, Ref, computed, ref, toRefs, withDefaults } from 'vue'
|
import { ComputedRef, Ref, computed, ref, toRefs, withDefaults } from 'vue'
|
||||||
|
|
||||||
import { AUTH_USER_STORE, USERS_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, USERS_STORE } from '@/store/constants'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile, IUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -62,7 +62,7 @@
|
|||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const { user, fromAdmin } = toRefs(props)
|
const { user, fromAdmin } = toRefs(props)
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const registrationDate = computed(() =>
|
const registrationDate = computed(() =>
|
||||||
|
@ -5,12 +5,12 @@ import {
|
|||||||
IAuthUserState,
|
IAuthUserState,
|
||||||
TAuthUserMutations,
|
TAuthUserMutations,
|
||||||
} from '@/store/modules/authUser/types'
|
} from '@/store/modules/authUser/types'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export const mutations: MutationTree<IAuthUserState> & TAuthUserMutations = {
|
export const mutations: MutationTree<IAuthUserState> & TAuthUserMutations = {
|
||||||
[AUTH_USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: IAuthUserState) {
|
[AUTH_USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: IAuthUserState) {
|
||||||
state.authToken = null
|
state.authToken = null
|
||||||
state.authUserProfile = <IUserProfile>{}
|
state.authUserProfile = <IAuthUserProfile>{}
|
||||||
},
|
},
|
||||||
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_TOKEN](
|
||||||
state: IAuthUserState,
|
state: IAuthUserState,
|
||||||
@ -20,7 +20,7 @@ export const mutations: MutationTree<IAuthUserState> & TAuthUserMutations = {
|
|||||||
},
|
},
|
||||||
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
||||||
state: IAuthUserState,
|
state: IAuthUserState,
|
||||||
authUserProfile: IUserProfile
|
authUserProfile: IAuthUserProfile
|
||||||
) {
|
) {
|
||||||
state.authUserProfile = authUserProfile
|
state.authUserProfile = authUserProfile
|
||||||
},
|
},
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { IAuthUserState } from '@/store/modules/authUser/types'
|
import { IAuthUserState } from '@/store/modules/authUser/types'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
|
|
||||||
export const authUserState: IAuthUserState = {
|
export const authUserState: IAuthUserState = {
|
||||||
authToken: null,
|
authToken: null,
|
||||||
authUserProfile: <IUserProfile>{},
|
authUserProfile: <IAuthUserProfile>{},
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
import { AUTH_USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
import { IRootState } from '@/store/modules/root/types'
|
import { IRootState } from '@/store/modules/root/types'
|
||||||
import {
|
import {
|
||||||
IUserProfile,
|
IAuthUserProfile,
|
||||||
ILoginOrRegisterData,
|
ILoginOrRegisterData,
|
||||||
IUserDeletionPayload,
|
IUserDeletionPayload,
|
||||||
IUserPasswordPayload,
|
IUserPasswordPayload,
|
||||||
@ -23,7 +23,7 @@ import {
|
|||||||
|
|
||||||
export interface IAuthUserState {
|
export interface IAuthUserState {
|
||||||
authToken: string | null
|
authToken: string | null
|
||||||
authUserProfile: IUserProfile
|
authUserProfile: IAuthUserProfile
|
||||||
isSuccess: boolean
|
isSuccess: boolean
|
||||||
loading: boolean
|
loading: boolean
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ export interface IAuthUserGetters {
|
|||||||
|
|
||||||
[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE](
|
[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE](
|
||||||
state: IAuthUserState
|
state: IAuthUserState
|
||||||
): IUserProfile
|
): IAuthUserProfile
|
||||||
|
|
||||||
[AUTH_USER_STORE.GETTERS.IS_ADMIN](state: IAuthUserState): boolean
|
[AUTH_USER_STORE.GETTERS.IS_ADMIN](state: IAuthUserState): boolean
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ export type TAuthUserMutations<S = IAuthUserState> = {
|
|||||||
): void
|
): void
|
||||||
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE](
|
||||||
state: S,
|
state: S,
|
||||||
authUserProfile: IUserProfile
|
authUserProfile: IAuthUserProfile
|
||||||
): void
|
): void
|
||||||
[AUTH_USER_STORE.MUTATIONS.UPDATE_IS_SUCCESS](
|
[AUTH_USER_STORE.MUTATIONS.UPDATE_IS_SUCCESS](
|
||||||
state: S,
|
state: S,
|
||||||
|
@ -8,9 +8,8 @@ export interface IUserProfile {
|
|||||||
birth_date: string | null
|
birth_date: string | null
|
||||||
created_at: string
|
created_at: string
|
||||||
email: string
|
email: string
|
||||||
|
email_to_confirm?: string
|
||||||
first_name: string | null
|
first_name: string | null
|
||||||
imperial_units: boolean
|
|
||||||
language: string | null
|
|
||||||
last_name: string | null
|
last_name: string | null
|
||||||
location: string | null
|
location: string | null
|
||||||
nb_sports: number
|
nb_sports: number
|
||||||
@ -18,10 +17,15 @@ export interface IUserProfile {
|
|||||||
picture: string | boolean
|
picture: string | boolean
|
||||||
records: IRecord[]
|
records: IRecord[]
|
||||||
sports_list: number[]
|
sports_list: number[]
|
||||||
timezone: string
|
|
||||||
total_distance: number
|
total_distance: number
|
||||||
total_duration: string
|
total_duration: string
|
||||||
username: string
|
username: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IAuthUserProfile extends IUserProfile {
|
||||||
|
imperial_units: boolean
|
||||||
|
language: string | null
|
||||||
|
timezone: string
|
||||||
weekm: boolean
|
weekm: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,12 +82,12 @@
|
|||||||
import UserStatsCards from '@/components/Dashboard/UserStatsCards/index.vue'
|
import UserStatsCards from '@/components/Dashboard/UserStatsCards/index.vue'
|
||||||
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
||||||
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(() =>
|
const sports: ComputedRef<ISport[]> = computed(() =>
|
||||||
|
@ -23,14 +23,14 @@
|
|||||||
|
|
||||||
import ErrorImg from '@/components/Common/Images/ErrorImg.vue'
|
import ErrorImg from '@/components/Common/Images/ErrorImg.vue'
|
||||||
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const isAuthenticated: ComputedRef<boolean> = computed(
|
const isAuthenticated: ComputedRef<boolean> = computed(
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
import { ComputedRef, computed } from 'vue'
|
import { ComputedRef, computed } from 'vue'
|
||||||
|
|
||||||
import { AUTH_USER_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE } from '@/store/constants'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
WORKOUTS_STORE,
|
WORKOUTS_STORE,
|
||||||
} from '@/store/constants'
|
} from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
import { IWorkoutData } from '@/types/workouts'
|
import { IWorkoutData } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
@ -30,7 +30,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<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const workoutData: ComputedRef<IWorkoutData> = computed(
|
const workoutData: ComputedRef<IWorkoutData> = computed(
|
||||||
|
@ -22,14 +22,14 @@
|
|||||||
WORKOUTS_STORE,
|
WORKOUTS_STORE,
|
||||||
} from '@/store/constants'
|
} from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
import { IWorkoutData } from '@/types/workouts'
|
import { IWorkoutData } from '@/types/workouts'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
WORKOUTS_STORE,
|
WORKOUTS_STORE,
|
||||||
} from '@/store/constants'
|
} from '@/store/constants'
|
||||||
import { ISport } from '@/types/sports'
|
import { ISport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } 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'
|
||||||
|
|
||||||
@ -78,7 +78,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<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
|
@ -34,14 +34,14 @@
|
|||||||
import WorkoutsList from '@/components/Workouts/WorkoutsList.vue'
|
import WorkoutsList from '@/components/Workouts/WorkoutsList.vue'
|
||||||
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
||||||
import { ISport, ITranslatedSport } from '@/types/sports'
|
import { ISport, ITranslatedSport } from '@/types/sports'
|
||||||
import { IUserProfile } from '@/types/user'
|
import { IAuthUserProfile } from '@/types/user'
|
||||||
import { useStore } from '@/use/useStore'
|
import { useStore } from '@/use/useStore'
|
||||||
import { translateSports } from '@/utils/sports'
|
import { translateSports } from '@/utils/sports'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const authUser: ComputedRef<IUserProfile> = computed(
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
||||||
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
||||||
)
|
)
|
||||||
const sports: ComputedRef<ISport[]> = computed(
|
const sports: ComputedRef<ISport[]> = computed(
|
||||||
|
Loading…
Reference in New Issue
Block a user