cleanup http

This commit is contained in:
2023-12-10 15:22:33 +01:00
parent 39c3cf2329
commit 82a9a9165f
8 changed files with 21 additions and 42 deletions
@@ -56,6 +56,7 @@ import { URLs } from '../../scripts/utils/apiURLs';
import { useMainStore } from '../../store/mainStore';
import Loading from '../Global/Loading.vue';
import { API } from '../../typings/api';
import http from '../../http';
export default defineComponent({
components: { Loading },
@@ -90,15 +91,11 @@ export default defineComponent({
}
const statsData: API.DispatcherStats.Response = await (
await axios.get(
`${URLs.stacjownikAPI}/api/getDispatcherInfo?name=${this.store.dispatcherStatsName}`
)
await http.get('api/getDispatcherInfo?name=${this.store.dispatcherStatsName}')
).data;
const timetables: API.TimetableHistory.Response = await (
await axios.get(
`${URLs.stacjownikAPI}/api/getTimetables?authorName=${this.store.dispatcherStatsName}`
)
await http.get('api/getTimetables?authorName=${this.store.dispatcherStatsName}')
).data;
this.timetables = timetables;
@@ -137,6 +137,7 @@ import dateMixin from '../../mixins/dateMixin';
import { URLs } from '../../scripts/utils/apiURLs';
import { API } from '../../typings/api';
import { Status } from '../../typings/common';
import http from '../../http';
export default defineComponent({
name: 'journal-daily-stats',
@@ -175,9 +176,7 @@ export default defineComponent({
methods: {
async fetchDailyTimetableStats() {
try {
const res: API.DailyStats.Response = await (
await axios.get(`${URLs.stacjownikAPI}/api/getDailyStats`)
).data;
const res: API.DailyStats.Response = await (await http.get('api/getDailyStats')).data;
this.stats = res;
@@ -110,14 +110,13 @@
</template>
<script lang="ts">
import axios from 'axios';
import { defineComponent, inject, PropType } from 'vue';
import keyMixin from '../../mixins/keyMixin';
import { URLs } from '../../scripts/utils/apiURLs';
import { useMainStore } from '../../store/mainStore';
import { Journal } from './typings';
import { API } from '../../typings/api';
import { Status } from '../../typings/common';
import http from '../../http';
export default defineComponent({
emits: ['onSearchConfirm', 'onOptionsReset', 'onRefreshData'],
@@ -216,9 +215,7 @@ export default defineComponent({
this.store.driverStatsStatus = Status.Data.Loading;
const statsData: API.DriverStats.Response = await (
await axios.get(
`${URLs.stacjownikAPI}/api/getDriverInfo?name=${this.store.driverStatsName}`
)
await http.get(`api/getDriverInfo?name=${this.store.driverStatsName}`)
).data;
this.store.driverStatsData = statsData;
@@ -241,7 +238,7 @@ export default defineComponent({
this.searchTimeout = window.setTimeout(async () => {
try {
const suggestions: string[] = await (
await axios.get(`${URLs.stacjownikAPI}/api/get${type}Suggestions?name=${value}`)
await http.get(`api/get${type}Suggestions?name=${value}`)
).data;
this[`${type}Suggestions`] = suggestions;