Skip to content

Commit

Permalink
fix: error page (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanilowicz authored Sep 14, 2023
1 parent 190056d commit b4e51d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-fans-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vue-demo-store": patch
---

Fix global error page
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<script setup lang="ts">
const props = withDefaults(
defineProps<{
errorCode?: number;
errorMessage?: string;
}>(),
{
errorCode: 404,
errorMessage: "",
},
);
const props = defineProps<{
error: {
statusCode: number;
statusMessage: string;
message: string;
};
}>();
const { t } = useI18n();
const localePath = useLocalePath();
const { formatLink } = useInternationalization(localePath);
Expand All @@ -21,7 +19,9 @@ const errorMessageMap: { [key: number]: string } = {
503: t("errorPages.503"),
};
const errorMessage = props.errorMessage || errorMessageMap[props.errorCode];
const errorMessage =
props.error.statusMessage ||
errorMessageMap[props.error.statusCode as keyof typeof errorMessageMap];
</script>

<script lang="ts">
Expand All @@ -38,7 +38,7 @@ export default {
<div class="max-w-md text-center">
<h1 class="mb-8 font-extrabold text-9xl">
<span class="sr-only">{{ $t("error") }}</span
>{{ errorCode }}
>{{ props.error.statusCode }}
</h1>
<p class="text-xl md:text-3xl font-semibold mt-4 mb-8">
{{ errorMessage }}
Expand Down

2 comments on commit b4e51d9

@vercel
Copy link

@vercel vercel bot commented on b4e51d9 Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

frontends-demo – ./templates/vue-demo-store

frontends-demo-git-main-shopware-frontends.vercel.app
frontends-demo.vercel.app
frontends-demo-shopware-frontends.vercel.app

@vercel
Copy link

@vercel vercel bot commented on b4e51d9 Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.