Client - refactor types
This commit is contained in:
@ -1,28 +1,7 @@
|
||||
import { ActionContext } from 'vuex'
|
||||
|
||||
import { ROOT_STORE } from '@/store/constants'
|
||||
|
||||
export interface IAppStatistics {
|
||||
sports: number
|
||||
uploads_dir_size: number
|
||||
users: number
|
||||
workouts: number
|
||||
}
|
||||
|
||||
export interface IAppConfig {
|
||||
federation_enabled: boolean
|
||||
gpx_limit_import: number | null
|
||||
is_registration_enabled: boolean
|
||||
map_attribution: string
|
||||
max_single_file_size: number | null
|
||||
max_users: number | null
|
||||
max_zip_file_size: number | null
|
||||
}
|
||||
|
||||
export interface IApplication {
|
||||
statistics: IAppStatistics
|
||||
config: IAppConfig
|
||||
}
|
||||
import { IAppConfig, IApplication } from '@/types/application'
|
||||
|
||||
export interface IRootState {
|
||||
root: boolean
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { MutationTree } from 'vuex'
|
||||
|
||||
import { ROOT_STORE } from '@/store/constants'
|
||||
import { IAppConfig, IRootState } from '@/store/modules/root/interfaces'
|
||||
import { IRootState } from '@/store/modules/root/interfaces'
|
||||
import { TRootMutations } from '@/store/modules/root/types'
|
||||
import { IAppConfig } from '@/types/application'
|
||||
|
||||
export const mutations: MutationTree<IRootState> & TRootMutations = {
|
||||
[ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES](state: IRootState) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { IRootState, IApplication } from '@/store/modules/root/interfaces'
|
||||
import { IRootState } from '@/store/modules/root/interfaces'
|
||||
import { IApplication } from '@/types/application'
|
||||
|
||||
export const state: IRootState = {
|
||||
root: true,
|
||||
|
@ -5,11 +5,8 @@ import api from '@/api/defaultApi'
|
||||
import router from '@/router'
|
||||
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
||||
import { IRootState } from '@/store/modules/root/interfaces'
|
||||
import {
|
||||
ILoginOrRegisterData,
|
||||
IUserActions,
|
||||
IUserState,
|
||||
} from '@/store/modules/user/interfaces'
|
||||
import { IUserActions, IUserState } from '@/store/modules/user/interfaces'
|
||||
import { ILoginOrRegisterData } from '@/types/user'
|
||||
import { handleError } from '@/utils'
|
||||
|
||||
export const actions: ActionTree<IUserState, IRootState> & IUserActions = {
|
||||
|
@ -1,35 +1,8 @@
|
||||
import { ActionContext } from 'vuex'
|
||||
|
||||
import { IFormData } from '@/interfaces'
|
||||
import { USER_STORE } from '@/store/constants'
|
||||
import { IRootState } from '@/store/modules/root/interfaces'
|
||||
|
||||
// DATA
|
||||
export interface IAuthUserProfile {
|
||||
admin: boolean
|
||||
bio: string | null
|
||||
birth_date: string | null
|
||||
created_at: string
|
||||
email: string
|
||||
first_name: string | null
|
||||
language: string | null
|
||||
last_name: string | null
|
||||
location: string | null
|
||||
nb_sports: number
|
||||
nb_workouts: number
|
||||
picture: string | boolean
|
||||
sports_list: number[]
|
||||
timezone: string
|
||||
total_distance: number
|
||||
total_duration: string
|
||||
username: string
|
||||
weekm: boolean
|
||||
}
|
||||
|
||||
export interface ILoginOrRegisterData {
|
||||
actionType: string
|
||||
formData: IFormData
|
||||
}
|
||||
import { IAuthUserProfile, ILoginOrRegisterData } from '@/types/user'
|
||||
|
||||
// STORE
|
||||
export interface IUserState {
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { MutationTree } from 'vuex'
|
||||
|
||||
import { USER_STORE } from '@/store/constants'
|
||||
import { IAuthUserProfile, IUserState } from '@/store/modules/user/interfaces'
|
||||
import { IUserState } from '@/store/modules/user/interfaces'
|
||||
import { TUserMutations } from '@/store/modules/user/types'
|
||||
import { IAuthUserProfile } from '@/types/user'
|
||||
|
||||
export const mutations: MutationTree<IUserState> & TUserMutations = {
|
||||
[USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: IUserState) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { IAuthUserProfile, IUserState } from '@/store/modules/user/interfaces'
|
||||
import { IUserState } from '@/store/modules/user/interfaces'
|
||||
import { IAuthUserProfile } from '@/types/user'
|
||||
|
||||
export const userState: IUserState = {
|
||||
authToken: null,
|
||||
|
@ -2,11 +2,11 @@ import { Store as VuexStore, CommitOptions, DispatchOptions } from 'vuex'
|
||||
|
||||
import { USER_STORE } from '@/store/constants'
|
||||
import {
|
||||
IAuthUserProfile,
|
||||
IUserActions,
|
||||
IUserGetters,
|
||||
IUserState,
|
||||
} from '@/store/modules/user/interfaces'
|
||||
import { IAuthUserProfile } from '@/types/user'
|
||||
|
||||
export type TUserMutations<S = IUserState> = {
|
||||
[USER_STORE.MUTATIONS.CLEAR_AUTH_USER_TOKEN](state: S): void
|
||||
|
Reference in New Issue
Block a user