Improvement of logout. Added Sacrital Service. Added website link for event places and direct link to other websites in worship overview

This commit is contained in:
Torsten Schulz
2024-09-06 16:34:17 +02:00
parent a869f2d16a
commit 5c6cfa41ab
14 changed files with 139 additions and 32 deletions

View File

@@ -24,7 +24,7 @@ axios.interceptors.response.use(
},
error => {
if (error.response && error.response.status === 401) {
store.commit('logout');
store.dispatch('logout');
router.push('/');
}
return Promise.reject(error);

View File

@@ -21,8 +21,12 @@ export default {
},
methods: {
...mapActions(['logout']),
navigateToLogin() {
this.$router.push('/login');
async handleLogout() {
try {
await this.logout();
} catch (error) {
console.error('Fehler beim Logout:', error);
}
}
}
};

View File

@@ -1,24 +1,32 @@
<template>
<div>
<table v-if="worships.length" class="worships">
<tr v-for="worship in worships" :key="worship.id" :style="worship.eventPlace && worship.eventPlace.backgroundColor ? `background-color:${worship.eventPlace.backgroundColor}` : ''">
<tr v-for="worship in worships" :key="worship.id"
:style="worship.eventPlace && worship.eventPlace.backgroundColor ? `background-color:${worship.eventPlace.backgroundColor}` : ''">
<td>
<div>{{ formatDate(worship.date) }}</div>
<div>{{ worship.dayName }}</div>
</td>
<td>
<div v-if="worship.neighborInvitation" class="neighborhood-invitation">Einladung zum Gottesdienst im Nachbarschaftsraum:</div>
<div v-if="worship.neighborInvitation" class="neighborhood-invitation">Einladung zum Gottesdienst im
Nachbarschaftsraum:</div>
<h3>
<span :class="worship.highlightTime ? 'highlight-time' : ''">{{ formatTime(worship.time) }}</span>&nbsp;-&nbsp;
<span :class="worship.highlightTime ? 'highlight-time' : ''">{{ formatTime(worship.time)
}}</span>&nbsp;-&nbsp;
{{ !worship.neighborInvitation ? worship.title : `Gottesdienst in ${worship.eventPlace.name}` }}
</h3>
<div v-if="worship.organizer">Gestaltung: {{ worship.organizer }}</div>
<div v-if="worship.sacristanService" class="internal-information">Küsterdienst: {{ worship.sacristanService }}</div>
<div v-if="worship.collection">Kollekte: {{ worship.collection }}</div>
<div v-if="worship.address">{{ worship.address }}</div>
<div v-if="!worship.address && worship.eventPlace.id && worship.eventPlace.id">
Adresse: {{ worship.eventPlace.name }}, {{ worship.eventPlace.street }}, {{ worship.eventPlace.city }}
Adresse: {{ worship.eventPlace.name }}, {{ worship.eventPlace.street }}, {{
worship.eventPlace.city }}
</div>
<div v-if="worship.selfInformation" class="selfinformation">Bitte informieren Sie sich auch auf den
<a v-if="worship.eventPlace.website" :href="worship.eventPlace.website" target="_blank">Internetseiten dieser Gemeinde!</a><span
v-else>Internetseiten dieser Gemeinde!</span>
</div>
<div v-if="worship.selfInformation" class="selfinformation">Bitte informieren Sie sich auch auf den Internetseiten dieser Gemeinde!</div>
</td>
</tr>
</table>
@@ -85,4 +93,11 @@ table.worships td div{
font-weight: bold;
color: #0020e0;
}
a {
color: #0020e0;
}
.internal-information {
color: #e45;
font-style: italic;
}
</style>

View File

@@ -10,6 +10,8 @@
<input type="text" id="zipcode" v-model="newEventPlace.zipcode" placeholder="PLZ" required>
<label for="city">Stadt:</label>
<input type="text" id="city" v-model="newEventPlace.city" placeholder="Stadt" required>
<label for="city">Webseite:</label>
<input type="text" id="website" v-model="newEventPlace.website" placeholder="Webseite" required>
<label for="backgroundColor">Hintergrundfarbe:</label>
<input type="color" id="backgroundColor" v-model="newEventPlace.backgroundColor">
<button type="submit">Speichern</button>
@@ -47,7 +49,8 @@ export default {
street: '',
zipcode: '',
city: '',
backgroundColor: '#ffffff'
backgroundColor: '#ffffff',
website: '',
},
editMode: false,
editId: null
@@ -87,7 +90,8 @@ export default {
street: '',
zipcode: '',
city: '',
backgroundColor: '#ffffff'
backgroundColor: '#ffffff',
website: '',
};
this.editMode = false;
this.editId = null;

View File

@@ -21,6 +21,9 @@
<label for="organizer">Gestalter:</label>
<input type="text" id="organizer" v-model="worshipData.organizer">
<label for="sacristanService">Küsterdienst:</label>
<input type="text" id="sacristanService" v-model="worshipData.sacristanService">
<label for="collection">Kollekte:</label>
<input type="text" id="collection" v-model="worshipData.collection">
@@ -77,7 +80,9 @@ export default {
selfInformation: false,
highlightTime: false,
neighborInvitation: false,
introLine: ''
introLine: '',
sacristanService: '',
website: '',
},
selectedEventPlace: null,
editMode: false,

View File

@@ -1,6 +1,6 @@
import { createStore } from 'vuex';
import axios from 'axios';
import router from '../router';
import router from '../router';
let user = [];
try {
@@ -94,8 +94,14 @@ export default createStore({
login({ commit }, { user, token }) {
commit('setLogin', { user, token });
},
logout({ commit }) {
commit('logout');
async logout({ commit }) {
try {
await axios.post('/auth/logout');
} catch (error) {
console.error('Fehler beim Logout:', error);
} finally {
commit('logout');
}
}
},
getters: {