axios: baseURL

This commit is contained in:
2023-02-10 14:42:11 +01:00
parent 446698b832
commit 580e109dda
7 changed files with 86 additions and 98 deletions
+6 -21
View File
@@ -55,7 +55,7 @@
<div class="pane">
Pokazuj maks.
<input type="number" min="1" v-model="store.maxVisibleResults" style="width: 50px; margin: 0 0.5em;" />
<input type="number" min="1" v-model="store.maxVisibleResults" style="width: 50px; margin: 0 0.5em" />
wyników
</div>
@@ -76,7 +76,6 @@
<script lang="ts">
import axios from 'axios';
import { defineComponent } from 'vue';
import dataMixin from '../mixins/dataMixin';
import routesMixin from '../mixins/routesMixin';
import { useStore } from '../store';
import { AuthState, Availability, ChangeProp, HeaderTypes, SceneryRowItem } from '../types/types';
@@ -95,7 +94,7 @@ export default defineComponent({
};
},
mixins: [dataMixin, routesMixin],
mixins: [routesMixin],
computed: {
changelog() {
@@ -133,7 +132,7 @@ export default defineComponent({
confirmLoadData() {
const confirmed = confirm('Czy na pewno chcesz odświeżyć dane? Wszelkie niezapisane zmiany zostaną utracone!');
if (confirmed) this.loadData();
if (confirmed) this.store.fetchSceneriesData();
},
confirmRestoreList() {
@@ -174,24 +173,10 @@ export default defineComponent({
return { ...v };
});
const response = await axios.post(
`${this.API_URL}/manager/updateSceneryList`,
{
changeList: mappedChangeList,
token: this.store.token,
notify: this.store.notifyDiscord,
},
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${this.store.token}`,
},
}
);
const updateResData = (await this.store.updateSceneriesData(mappedChangeList)).data
this.store.changesResponse = updateResData;
this.store.changesResponse = response.data;
this.loadData();
this.store.fetchSceneriesData();
} catch (error) {
this.store.alertMessage = 'Ups! Wystąpił błąd podczas zapisywania danych!';
}