update js dependencies
This commit is contained in:
@ -5,8 +5,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { ChartData, ChartOptions, LayoutItem } from 'chart.js'
|
||||
import { ComputedRef, PropType, computed, defineComponent } from 'vue'
|
||||
import { ChartOptions, LayoutItem } from 'chart.js'
|
||||
import { PropType, computed, defineComponent } from 'vue'
|
||||
import { BarChart, useBarChart } from 'vue-chart-3'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
? 'm'
|
||||
: 'km'
|
||||
}
|
||||
const chartData: ComputedRef<ChartData<'bar'>> = computed(() => ({
|
||||
const chartData = computed(() => ({
|
||||
labels: props.labels,
|
||||
// workaround to avoid dataset modification
|
||||
datasets: JSON.parse(JSON.stringify(props.datasets)),
|
||||
|
@ -108,7 +108,7 @@
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
[displayDistance.value ? 'xDistance' : 'xDuration']: {
|
||||
x: {
|
||||
grid: {
|
||||
drawOnChartArea: false,
|
||||
},
|
||||
|
@ -19,3 +19,8 @@ export interface IQueryOptions {
|
||||
defaultSort?: string
|
||||
query?: TPaginationPayload
|
||||
}
|
||||
|
||||
export interface IApiErrorMessage {
|
||||
error?: string
|
||||
message?: string
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import { ISportsState } from '@/store/modules/sports/types'
|
||||
import { IStatisticsState } from '@/store/modules/statistics/types'
|
||||
import { IUsersState } from '@/store/modules/users/types'
|
||||
import { IWorkoutsState } from '@/store/modules/workouts/types'
|
||||
import { IApiErrorMessage } from '@/types/api'
|
||||
|
||||
export const getApiUrl = (): string => {
|
||||
return process.env.NODE_ENV === 'production'
|
||||
@ -33,11 +34,11 @@ export const handleError = (
|
||||
return
|
||||
}
|
||||
|
||||
const errorInfo: IApiErrorMessage | null =
|
||||
error?.response && error.response.data ? error.response.data : null
|
||||
|
||||
// if stored token is blacklisted, disconnect user
|
||||
if (
|
||||
error?.response?.status === 401 &&
|
||||
error.response.data.error === 'invalid_token'
|
||||
) {
|
||||
if (error?.response?.status === 401 && errorInfo?.error === 'invalid_token') {
|
||||
localStorage.removeItem('authToken')
|
||||
context.dispatch(AUTH_USER_STORE.ACTIONS.CHECK_AUTH_USER)
|
||||
return
|
||||
@ -48,8 +49,8 @@ export const handleError = (
|
||||
: error.response
|
||||
? error.response.status === 413
|
||||
? 'file size is greater than the allowed size'
|
||||
: error.response.data.message
|
||||
? error.response.data.message
|
||||
: errorInfo?.message
|
||||
? errorInfo.message
|
||||
: msg
|
||||
: error.message
|
||||
? error.message
|
||||
|
Reference in New Issue
Block a user