mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
migracja http clienta do apiStore
This commit is contained in:
@@ -37,7 +37,6 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, provide, reactive, Ref, ref } from 'vue';
|
||||
|
||||
import http from '../http';
|
||||
import { useMainStore } from '../store/mainStore';
|
||||
import { LocationQuery } from 'vue-router';
|
||||
import { Journal } from '../components/JournalView/typings';
|
||||
@@ -48,6 +47,7 @@ import JournalDispatchersList from '../components/JournalView/JournalDispatchers
|
||||
import JournalOptions from '../components/JournalView/JournalOptions.vue';
|
||||
import JournalHeader from '../components/JournalView/JournalHeader.vue';
|
||||
import JournalStats from '../components/JournalView/JournalStats.vue';
|
||||
import { useApiStore } from '../store/apiStore';
|
||||
|
||||
const statsButtons: Journal.StatsButton[] = [
|
||||
{
|
||||
@@ -120,6 +120,7 @@ export default defineComponent({
|
||||
|
||||
return {
|
||||
mainStore: useMainStore(),
|
||||
apiStore: useApiStore(),
|
||||
|
||||
sorterActive,
|
||||
searchersValues,
|
||||
@@ -201,7 +202,7 @@ export default defineComponent({
|
||||
|
||||
try {
|
||||
const statsData: API.DispatcherStats.Response = await (
|
||||
await http.get('api/getDispatcherStats', {
|
||||
await this.apiStore.client!.get('api/getDispatcherStats', {
|
||||
params: {
|
||||
name: this.mainStore.dispatcherStatsName
|
||||
}
|
||||
@@ -236,7 +237,9 @@ export default defineComponent({
|
||||
this.countFromIndex = this.historyList.length;
|
||||
|
||||
const responseData: API.DispatcherHistory.Response = await (
|
||||
await http.get(`api/getDispatchers?${this.currentQuery}&countFrom=${this.countFromIndex}`)
|
||||
await this.apiStore.client!.get(
|
||||
`api/getDispatchers?${this.currentQuery}&countFrom=${this.countFromIndex}`
|
||||
)
|
||||
).data;
|
||||
|
||||
if (!responseData) return;
|
||||
@@ -283,7 +286,7 @@ export default defineComponent({
|
||||
if (reset) this.dataStatus = Status.Data.Loading;
|
||||
|
||||
const responseData: API.DispatcherHistory.Response = await (
|
||||
await http.get(`api/getDispatchers?${this.currentQuery}`)
|
||||
await this.apiStore.client!.get(`api/getDispatchers?${this.currentQuery}`)
|
||||
).data;
|
||||
|
||||
if (!responseData) {
|
||||
|
||||
@@ -53,7 +53,7 @@ import JournalTimetablesList from '../components/JournalView/JournalTimetables/J
|
||||
import { Journal } from '../components/JournalView/typings';
|
||||
import { Status } from '../typings/common';
|
||||
import { API } from '../typings/api';
|
||||
import http from '../http';
|
||||
import { useApiStore } from '../store/apiStore';
|
||||
|
||||
export const journalTimetableFilters: Journal.TimetableFilter[] = [
|
||||
{
|
||||
@@ -158,6 +158,7 @@ export default defineComponent({
|
||||
data: () => ({
|
||||
journalTimetableFilters,
|
||||
mainStore: useMainStore(),
|
||||
apiStore: useApiStore(),
|
||||
|
||||
statsButtons: [
|
||||
{
|
||||
@@ -282,7 +283,9 @@ export default defineComponent({
|
||||
this.mainStore.driverStatsStatus = Status.Data.Loading;
|
||||
|
||||
const statsData: API.DriverStats.Response = await (
|
||||
await http.get(`api/getDriverInfo?name=${this.mainStore.driverStatsName}`)
|
||||
await this.apiStore.client!.get(
|
||||
`api/getDriverInfo?name=${this.mainStore.driverStatsName}`
|
||||
)
|
||||
).data;
|
||||
|
||||
this.mainStore.driverStatsData = statsData;
|
||||
@@ -321,7 +324,7 @@ export default defineComponent({
|
||||
this.currentQueryParams['countFrom'] = this.timetableHistory.length;
|
||||
|
||||
const responseData: API.TimetableHistory.Response = await (
|
||||
await http.get('api/getTimetables', {
|
||||
await this.apiStore.client!.get('api/getTimetables', {
|
||||
params: { ...this.currentQueryParams }
|
||||
})
|
||||
).data;
|
||||
@@ -425,7 +428,7 @@ export default defineComponent({
|
||||
|
||||
try {
|
||||
const responseData: API.TimetableHistory.Response = await (
|
||||
await http.get('api/getTimetables', {
|
||||
await this.apiStore.client!.get('api/getTimetables', {
|
||||
params: this.currentQueryParams
|
||||
})
|
||||
).data;
|
||||
|
||||
@@ -99,6 +99,7 @@ export default defineComponent({
|
||||
|
||||
.wrapper {
|
||||
max-width: 100%;
|
||||
width: 1700px;
|
||||
}
|
||||
|
||||
.stations-options {
|
||||
|
||||
Reference in New Issue
Block a user