mirror of
https://github.com/Spythere/station-manager-2.0.git
synced 2026-05-03 05:28:13 +00:00
zmiana endpointów; poprawki designu
This commit is contained in:
@@ -21,19 +21,13 @@
|
||||
<button @click="addNewStation">Dodaj nową stację</button>
|
||||
<button @click="confirmLoadData">Odśwież dane</button>
|
||||
|
||||
<button @click="confirmUpdateList" :data-disabled="!store.unsavedChanges" :disabled="!store.unsavedChanges">
|
||||
Zapisz zmiany
|
||||
</button>
|
||||
<button @click="confirmUpdateList" :data-disabled="!store.unsavedChanges" :disabled="!store.unsavedChanges">Zapisz zmiany</button>
|
||||
<button @click="signOut">Wyloguj się</button>
|
||||
</div>
|
||||
|
||||
<div class="pane notify-pane">
|
||||
<label id="notify">
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="store.notifyDiscord"
|
||||
@input="onNotifyCheckboxChange(($event.target as HTMLInputElement)!.checked)"
|
||||
/>
|
||||
<input type="checkbox" v-model="store.notifyDiscord" @input="onNotifyCheckboxChange(($event.target as HTMLInputElement)!.checked)" />
|
||||
<span>
|
||||
Powiadom o zmianach: <b>{{ store.notifyDiscord ? 'TAK' : 'NIE' }}</b>
|
||||
</span>
|
||||
@@ -41,14 +35,7 @@
|
||||
</div>
|
||||
|
||||
<div class="pane search-pane">
|
||||
<input
|
||||
class="search"
|
||||
ref="search"
|
||||
type="text"
|
||||
v-model="store.searchedSceneryName"
|
||||
placeholder="Wpisz nazwę scenerii..."
|
||||
width="350"
|
||||
/>
|
||||
<input class="search" ref="search" type="text" v-model="store.searchedSceneryName" placeholder="Wpisz nazwę scenerii..." width="350" />
|
||||
|
||||
<button style="margin-left: 0.5em" @click="clearInput">Wyczyść</button>
|
||||
</div>
|
||||
@@ -66,9 +53,7 @@
|
||||
</div>
|
||||
|
||||
<div class="pane">
|
||||
<button @click="changelogVisible = !changelogVisible">
|
||||
{{ changelogVisible ? 'Ukryj' : 'Pokaż' }} changelog
|
||||
</button>
|
||||
<button @click="changelogVisible = !changelogVisible">{{ changelogVisible ? 'Ukryj' : 'Pokaż' }} changelog</button>
|
||||
</div>
|
||||
|
||||
<div class="changelog" v-if="changelogVisible">
|
||||
@@ -82,10 +67,11 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import routesMixin from '../mixins/routesMixin';
|
||||
import { useStore, baseURL } from '../store';
|
||||
import { useStore } from '../store';
|
||||
import { AuthState, Availability, ChangeProp, HeaderTypes, SceneryRoutesInfo, SceneryRowItem } from '../types/types';
|
||||
import { getAvailabilityValue } from '../types/typeUitls';
|
||||
import axios from 'axios';
|
||||
import client from '../common/http';
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
@@ -115,12 +101,7 @@ export default defineComponent({
|
||||
|
||||
if (/id|name/.test(propChange)) continue;
|
||||
|
||||
let value =
|
||||
typeof changeItem[propChange] === 'boolean'
|
||||
? changeItem[propChange]
|
||||
? 'TAK'
|
||||
: 'NIE'
|
||||
: changeItem[propChange];
|
||||
let value = typeof changeItem[propChange] === 'boolean' ? (changeItem[propChange] ? 'TAK' : 'NIE') : changeItem[propChange];
|
||||
|
||||
if (propChange == 'availability') value = getAvailabilityValue(changeItem[propChange] as Availability);
|
||||
if (propChange == 'routesInfo') value = this.getRouteNames(changeItem[propChange] as SceneryRoutesInfo[]);
|
||||
@@ -142,9 +123,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
confirmRestoreList() {
|
||||
const confirmed = confirm(
|
||||
'Czy na pewno chcesz zresetować listę do ustawień z pliku? Wszelkie niezapisane zmiany zostaną utracone!'
|
||||
);
|
||||
const confirmed = confirm('Czy na pewno chcesz zresetować listę do ustawień z pliku? Wszelkie niezapisane zmiany zostaną utracone!');
|
||||
|
||||
if (confirmed) this.restoreList();
|
||||
},
|
||||
@@ -156,7 +135,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
async signOut() {
|
||||
await axios.post('/auth/logout', {}, { baseURL, withCredentials: true });
|
||||
await client.post('/auth/logout');
|
||||
|
||||
this.$router.push('/login');
|
||||
this.store.removeUserData();
|
||||
@@ -182,6 +161,7 @@ export default defineComponent({
|
||||
this.store.fetchSceneriesData();
|
||||
} catch (error) {
|
||||
this.store.alertMessage = 'Ups! Wystąpił błąd podczas zapisywania danych!';
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -189,11 +169,7 @@ export default defineComponent({
|
||||
const name = prompt('Nazwa nowej scenerii');
|
||||
if (!name) return;
|
||||
|
||||
if (
|
||||
this.store.stationList.some(
|
||||
(station) => station.name.toLocaleLowerCase('pl-PL') == name.toLocaleLowerCase('pl-PL')
|
||||
)
|
||||
) {
|
||||
if (this.store.stationList.some((station) => station.name.toLocaleLowerCase('pl-PL') == name.toLocaleLowerCase('pl-PL'))) {
|
||||
this.store.alertMessage = 'Sceneria o takiej nazwie już istnieje!';
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user