Error page

This commit is contained in:
2024-11-05 18:43:47 +01:00
parent c3d0cc2879
commit ce097e2098
19 changed files with 136 additions and 19 deletions

View File

@@ -117,6 +117,9 @@ band.get("/band/:name", (req: Request, res: Response) => {
res.status(200).json(band) res.status(200).json(band)
}) })
.catch(e => {
res.status(404).send()
})
}) })

View File

@@ -110,6 +110,9 @@ concert.get("/concert/:id", (req: Request, res: Response) => {
res.status(200).json(concert) res.status(200).json(concert)
}) })
.catch(e => {
res.status(404).send()
})
}) })

View File

@@ -98,6 +98,9 @@ location.get("/location/:urlName", (req: Request, res: Response) => {
res.status(200).json(location) res.status(200).json(location)
}) })
.catch(e => {
res.status(404).send()
})
}) })

View File

@@ -61,7 +61,6 @@ order.get("/:id", (req: Request, res: Response) => {
// Place a new order // Place a new order
order.post("/", (req: Request, res: Response) => { order.post("/", (req: Request, res: Response) => {
console.log(req.body.tickets)
Order.create(req.body) Order.create(req.body)
.then(async order => { .then(async order => {
for (let ticket of req.body.tickets) { for (let ticket of req.body.tickets) {

View File

@@ -8,10 +8,12 @@ import { usePreferencesStore } from './stores/preferences.store';
import { useFeedbackStore } from './stores/feedback.store'; import { useFeedbackStore } from './stores/feedback.store';
import companyFooter from './components/navigation/companyFooter.vue'; import companyFooter from './components/navigation/companyFooter.vue';
import urlBar from './components/navigation/urlBar.vue'; import urlBar from './components/navigation/urlBar.vue';
import { useRouter } from 'vue-router';
const preferencesStore = usePreferencesStore() const preferencesStore = usePreferencesStore()
const feedbackStore = useFeedbackStore() const feedbackStore = useFeedbackStore()
const theme = useTheme() const theme = useTheme()
const router = useRouter()
theme.global.name.value = preferencesStore.theme theme.global.name.value = preferencesStore.theme
@@ -20,6 +22,13 @@ theme.global.name.value = preferencesStore.theme
watch(() => preferencesStore.language, () => { watch(() => preferencesStore.language, () => {
i18n.global.locale = preferencesStore.language i18n.global.locale = preferencesStore.language
}, { immediate: true }) }, { immediate: true })
watch(() => feedbackStore.notFound, () => {
if (feedbackStore.notFound) {
feedbackStore.notFound = false
router.push("/404")
}
})
</script> </script>
<template> <template>

View File

@@ -25,6 +25,10 @@ defineProps({
> >
<slot></slot> <slot></slot>
<template #borderless>
<slot name="borderless"></slot>
</template>
<template #actions> <template #actions>
<slot name="actions"></slot> <slot name="actions"></slot>
</template> </template>

View File

@@ -86,7 +86,7 @@
"userData": { "userData": {
"username": "Username", "username": "Username",
"password": "Passwort", "password": "Passwort",
"address": "Adresse | Addressen", "address": "Adresse | Adressen",
"payment": "Bezahlart | Bezahlarten", "payment": "Bezahlart | Bezahlarten",
"email": "E-Mail-Adresse", "email": "E-Mail-Adresse",
"firstName": "Vorname", "firstName": "Vorname",
@@ -173,6 +173,10 @@
"bandSavedSuccessful": "Band erfolgreich gespeichert" "bandSavedSuccessful": "Band erfolgreich gespeichert"
}, },
"misc": { "misc": {
"404": {
"title": "Seite nicht gefunden",
"headline": "404"
},
"sortBy": "Sortieren nach", "sortBy": "Sortieren nach",
"greeting": "Hallo {msg}", "greeting": "Hallo {msg}",
"from": "ab", "from": "ab",

View File

@@ -173,6 +173,10 @@
"bandSavedSuccessful": "Band successfully saved" "bandSavedSuccessful": "Band successfully saved"
}, },
"misc": { "misc": {
"404": {
"title": "Page not found",
"headline": "404"
},
"sortBy": "Sort by", "sortBy": "Sort by",
"greeting": "Hello {msg}", "greeting": "Hello {msg}",
"from": "from", "from": "from",

View File

@@ -7,14 +7,22 @@ import concertSection from './concertSection.vue';
import heroImage from '@/components/pageParts/heroImage.vue'; import heroImage from '@/components/pageParts/heroImage.vue';
import sectionDivider from '@/components/basics/sectionDivider.vue'; import sectionDivider from '@/components/basics/sectionDivider.vue';
import { useBandStore } from '@/stores/band.store'; import { useBandStore } from '@/stores/band.store';
import { onMounted, watch } from 'vue';
const router = useRouter() const router = useRouter()
const bandStore = useBandStore() const bandStore = useBandStore()
bandStore.getBand(String(router.currentRoute.value.params.name).replaceAll('-', ' ')) onMounted(async () => {
bandStore.getBand(String(router.currentRoute.value.params.name).replaceAll('-', ' '))
})
watch(() => router.currentRoute.value.params.name, () => {
bandStore.getBand(String(router.currentRoute.value.params.name).replaceAll('-', ' '))
})
</script> </script>
<template> <template>
{{ router.currentRoute.value.params.name }}
<hero-image <hero-image
:image="bandStore.band.imageMembers" :image="bandStore.band.imageMembers"
:logo="bandStore.band.logo" :logo="bandStore.band.logo"

View File

@@ -8,12 +8,19 @@ import outlinedButton from '@/components/basics/outlinedButton.vue';
import { useConcertStore } from '@/stores/concert.store'; import { useConcertStore } from '@/stores/concert.store';
import ticketListItem from '@/components/pageParts/ticketListItem.vue'; import ticketListItem from '@/components/pageParts/ticketListItem.vue';
import circularProgressIndeterminate from '@/components/basics/circularProgressIndeterminate.vue'; import circularProgressIndeterminate from '@/components/basics/circularProgressIndeterminate.vue';
import { onMounted, watch } from 'vue';
const router = useRouter() const router = useRouter()
const basketStore = useBasketStore() const basketStore = useBasketStore()
const concertStore = useConcertStore() const concertStore = useConcertStore()
concertStore.getConcert(Number(router.currentRoute.value.params.id)) onMounted(async () => {
concertStore.getConcert(Number(router.currentRoute.value.params.id))
})
watch(() => router.currentRoute.value.params.id, () => {
concertStore.getConcert(Number(router.currentRoute.value.params.id))
})
</script> </script>
<template> <template>

View File

@@ -1,14 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { useConcertStore } from '@/stores/concert.store'; import { useConcertStore } from '@/stores/concert.store';
import concertListItem from '@/components/pageParts/concertListItem.vue';
import cardViewHorizontal from '@/components/basics/cardViewHorizontal.vue';
import sectionDivider from '@/components/basics/sectionDivider.vue';
import concertFilterbar from './concertFilterbar.vue'; import concertFilterbar from './concertFilterbar.vue';
import ConcertsListSection from './concertsListSection.vue'; import ConcertsListSection from './concertsListSection.vue';
import { onMounted } from 'vue';
const concertStore = useConcertStore() const concertStore = useConcertStore()
concertStore.getConcerts() onMounted(async () => {
concertStore.getConcerts()
})
</script> </script>
<template> <template>

View File

@@ -4,11 +4,18 @@ import heroImage from '@/components/pageParts/heroImage.vue';
import { useLocationStore } from '@/stores/location.store'; import { useLocationStore } from '@/stores/location.store';
import locationConcertsSection from './locationConcertsSection.vue'; import locationConcertsSection from './locationConcertsSection.vue';
import LocationSeatMapSection from './locationSeatMapSection.vue'; import LocationSeatMapSection from './locationSeatMapSection.vue';
import { onMounted, watch } from 'vue';
const router = useRouter() const router = useRouter()
const locationStore = useLocationStore() const locationStore = useLocationStore()
locationStore.getLocationByName(String(router.currentRoute.value.params.name)) onMounted(async () => {
locationStore.getLocationByName(String(router.currentRoute.value.params.name))
})
watch(() => router.currentRoute.value.params.name, () => {
locationStore.getLocationByName(String(router.currentRoute.value.params.name))
})
</script> </script>
<template> <template>

View File

@@ -42,13 +42,24 @@ async function doOrder() {
max-width="800" max-width="800"
persistent persistent
> >
<v-list class="pa-0"> <v-radio-group class="pa-0" v-model="basketStore.usedAddress">
<v-list-subheader> <v-list-subheader>
{{ $t('account.userData.address', accountStore.userAccount.addresses.length) }} {{ $t('account.userData.address', accountStore.userAccount.addresses.length) }}
</v-list-subheader> </v-list-subheader>
<v-list-item> <v-list-item
<v-radio-group v-for="address in accountStore.userAccount.addresses"
>
<v-list-item-title>
<v-radio :label="address.street + '' + address.houseNumber" />
</v-list-item-title>
<v-list-item-subtitle>
{{ address.postalCode }} {{ address.city }}
</v-list-item-subtitle>
<!-- <v-radio-group
v-model="basketStore.usedAddress" v-model="basketStore.usedAddress"
:error="addressError" :error="addressError"
> >
@@ -58,24 +69,35 @@ async function doOrder() {
:label="address.street + ' ' + address.houseNumber + ', ' + address.postalCode + ' ' + address.city" :label="address.street + ' ' + address.houseNumber + ', ' + address.postalCode + ' ' + address.city"
/> />
</v-radio-group> </v-radio-group> -->
</v-list-item> </v-list-item>
</v-radio-group>
<v-list>
<v-list-subheader> <v-list-subheader>
{{ $t('account.userData.payment', accountStore.userAccount.payments.length) }} {{ $t('account.userData.payment', accountStore.userAccount.payments.length) }}
</v-list-subheader> </v-list-subheader>
<v-list-item> <v-list-item v-for="payment in accountStore.userAccount.payments">
<v-radio-group <template #prepend="{ isActive }">
<v-list-item-action start>
<v-radio :model-value="isActive" />
</v-list-item-action>
</template>
<v-list-item-title>{{ payment.bankName }}</v-list-item-title>
<v-list-item-subtitle>{{ payment.iban }}</v-list-item-subtitle>
<!-- <v-radio-group
v-model="basketStore.usedPayment" v-model="basketStore.usedPayment"
> >
<v-radio <v-radio
v-for="payment in accountStore.userAccount.payments"
:value="payment" :value="payment"
:label="payment.bankName + ': ' + payment.iban" :label="payment.bankName + ': ' + payment.iban"
:error="paymentError" :error="paymentError"
/> />
</v-radio-group> </v-radio-group> -->
</v-list-item> </v-list-item>
</v-list> </v-list>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
console.log("Error Page")
</script>
<template>
<v-container>
<v-row>
<v-col>
<v-empty-state
:headline="$t('misc.404.headline')"
:title="$t('misc.404.title')"
icon="mdi-robot-dead"
/>
</v-col>
</v-row>
</v-container>
</template>

View File

@@ -14,10 +14,17 @@ import OrdersPage from "@/pages/account/ordersPage/index.vue";
import LoginPage from "@/pages/account/loginPage/index.vue" import LoginPage from "@/pages/account/loginPage/index.vue"
import PreferencesPage from "@/pages/misc/preferencesPage/index.vue"; import PreferencesPage from "@/pages/misc/preferencesPage/index.vue";
import HelpPage from "@/pages/misc/helpPage/index.vue" import HelpPage from "@/pages/misc/helpPage/index.vue"
import ErrorPage from "@/pages/misc/errorPage/index.vue"
const routes = [ const routes = [
// Main page // Main page
{ path: "/", component: HomePage }, { path: "/", component: HomePage },
{
path: "/:pathMatch(.*)*",
redirect: to => {
return { path: "/404" }
}
},
// Account // Account
{ path: '/account/home', component: AccountHomePage }, { path: '/account/home', component: AccountHomePage },
@@ -44,7 +51,10 @@ const routes = [
{ path: '/search', component: SearchPage }, { path: '/search', component: SearchPage },
{ path: '/basket', component: BasketPage }, { path: '/basket', component: BasketPage },
{ path: '/preferences', component: PreferencesPage }, { path: '/preferences', component: PreferencesPage },
{ path: '/help', component: HelpPage } { path: '/help', component: HelpPage },
// Error Page
{ path: "/404", component: ErrorPage }
] ]
export default routes export default routes

View File

@@ -58,6 +58,7 @@ export const useBandStore = defineStore("bandStore", {
* @param name Name of band * @param name Name of band
*/ */
async getBand(name: string) { async getBand(name: string) {
const feedbackStore = useFeedbackStore()
this.fetchInProgress = true this.fetchInProgress = true
await fetchBandByName(name) await fetchBandByName(name)
@@ -65,6 +66,9 @@ export const useBandStore = defineStore("bandStore", {
this.band = result.data this.band = result.data
this.fetchInProgress = false this.fetchInProgress = false
}) })
.catch(res => {
feedbackStore.notFound = true
})
}, },
/** /**

View File

@@ -5,6 +5,7 @@ import { fetchConcertById, fetchAllConcerts, fetchUpcomingConcerts } from "../da
import { ConcertDetailsApiModel } from "../data/models/acts/concertDetailsApiModel"; import { ConcertDetailsApiModel } from "../data/models/acts/concertDetailsApiModel";
import { CityModel } from "@/data/models/locations/cityModel"; import { CityModel } from "@/data/models/locations/cityModel";
import { ConcertModel } from "@/data/models/acts/concertModel"; import { ConcertModel } from "@/data/models/acts/concertModel";
import { useFeedbackStore } from "./feedback.store";
export const useConcertStore = defineStore("concertStore", { export const useConcertStore = defineStore("concertStore", {
state: () => ({ state: () => ({
@@ -60,6 +61,7 @@ export const useConcertStore = defineStore("concertStore", {
* @param id ID of the concert in the database * @param id ID of the concert in the database
*/ */
async getConcert(id: number) { async getConcert(id: number) {
const feedbackStore = useFeedbackStore()
this.fetchInProgress = true this.fetchInProgress = true
fetchConcertById(id) fetchConcertById(id)
@@ -67,6 +69,9 @@ export const useConcertStore = defineStore("concertStore", {
this.concert = result.data this.concert = result.data
this.fetchInProgress = false this.fetchInProgress = false
}) })
.catch(res => {
feedbackStore.notFound = true
})
}, },
/** /**

View File

@@ -13,7 +13,10 @@ export const useFeedbackStore = defineStore("feedbackStore", {
title: ref(""), title: ref(""),
color: ref(""), color: ref(""),
icon: ref(""), icon: ref(""),
$i18n: {} $i18n: {},
/** Band, Location or concert on URL does not exist, redirect to 404 page */
notFound: ref(false)
}), }),
getters: { getters: {

View File

@@ -5,6 +5,7 @@ import { LocationApiModel } from "../data/models/locations/locationApiModel";
import { CityModel } from "../data/models/locations/cityModel"; import { CityModel } from "../data/models/locations/cityModel";
import { fetchAllCities } from "../data/api/cityApi"; import { fetchAllCities } from "../data/api/cityApi";
import { LocationDetailsApiModel } from "@/data/models/locations/locationDetailsApiModel"; import { LocationDetailsApiModel } from "@/data/models/locations/locationDetailsApiModel";
import { useFeedbackStore } from "./feedback.store";
export const useLocationStore = defineStore("locationStore", { export const useLocationStore = defineStore("locationStore", {
state: () => ({ state: () => ({
@@ -46,6 +47,7 @@ export const useLocationStore = defineStore("locationStore", {
}, },
getLocationByName(name: string) { getLocationByName(name: string) {
const feedbackStore = useFeedbackStore()
this.fetchInProgress = true this.fetchInProgress = true
fetchLocationByName(name) fetchLocationByName(name)
@@ -53,6 +55,9 @@ export const useLocationStore = defineStore("locationStore", {
this.location = result.data this.location = result.data
this.fetchInProgress = false this.fetchInProgress = false
}) })
.catch(res => {
feedbackStore.notFound = true
})
}, },
/** /**