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
+3 -8
View File
@@ -32,10 +32,8 @@
<script lang="ts">
import { defineComponent, provide, reactive, Ref, ref } from 'vue';
import axios from 'axios';
import JournalOptions from '../components/JournalView/JournalOptions.vue';
import { URLs } from '../scripts/utils/apiURLs';
import { useMainStore } from '../store/mainStore';
import JournalDispatchersList from '../components/JournalView/JournalDispatchersList.vue';
@@ -44,8 +42,7 @@ import { LocationQuery } from 'vue-router';
import { Journal } from '../components/JournalView/typings';
import { API } from '../typings/api';
import { Status } from '../typings/common';
const DISPATCHERS_API_URL = `${URLs.stacjownikAPI}/api/getDispatchers`;
import http from '../http';
export default defineComponent({
components: {
@@ -183,9 +180,7 @@ export default defineComponent({
this.countFromIndex = this.historyList.length;
const responseData: API.DispatcherHistory.Response = await (
await axios.get(
`${DISPATCHERS_API_URL}?${this.currentQuery}&countFrom=${this.countFromIndex}`
)
await http.get(`api/getDispatchers?${this.currentQuery}&countFrom=${this.countFromIndex}`)
).data;
if (!responseData) return;
@@ -232,7 +227,7 @@ export default defineComponent({
if (reset) this.dataStatus = Status.Data.Loading;
const responseData: API.DispatcherHistory.Response = await (
await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}`)
await http.get(`api/getDispatchers?${this.currentQuery}`)
).data;
if (!responseData) {
+3 -6
View File
@@ -35,7 +35,6 @@
<script lang="ts">
import { defineComponent, provide, reactive, Ref, ref } from 'vue';
import axios from 'axios';
import dateMixin from '../mixins/dateMixin';
import routerMixin from '../mixins/routerMixin';
@@ -45,7 +44,6 @@ import JournalOptions from '../components/JournalView/JournalOptions.vue';
import JournalStats from '../components/JournalView/JournalStats.vue';
import JournalHeader from '../components/JournalView/JournalHeader.vue';
import { URLs } from '../scripts/utils/apiURLs';
import { useMainStore } from '../store/mainStore';
import { LocationQuery } from 'vue-router';
@@ -54,8 +52,7 @@ import JournalTimetablesList from '../components/JournalView/JournalTimetables/J
import { Journal } from '../components/JournalView/typings';
import { Status } from '../typings/common';
import { API } from '../typings/api';
const TIMETABLES_API_URL = `${URLs.stacjownikAPI}/api/getTimetables`;
import http from '../http';
export const journalTimetableFilters: Journal.TimetableFilter[] = [
{
@@ -272,7 +269,7 @@ export default defineComponent({
this.currentQueryParams['countFrom'] = this.timetableHistory.length;
const responseData: API.TimetableHistory.Response = await (
await axios.get(`${TIMETABLES_API_URL}`, {
await http.get('api/getTimetables', {
params: { ...this.currentQueryParams }
})
).data;
@@ -365,7 +362,7 @@ export default defineComponent({
try {
const responseData: API.TimetableHistory.Response = await (
await axios.get(`${TIMETABLES_API_URL}`, {
await http.get('api/getTimetables', {
params: this.currentQueryParams
})
).data;