Skip to content

Commit a119bf7

Browse files
sequensucksFrodigo
authored andcommitted
feat: implement magento url rewrites
re #181
1 parent 2332431 commit a119bf7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/theme/pages/Cms.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
<script lang="ts">
1818
import { SfLoader, SfHeading } from '@storefront-ui/vue';
1919
import {
20-
defineComponent, ref, useFetch,
20+
defineComponent,
21+
ref,
22+
useFetch,
23+
useContext,
2124
} from '@nuxtjs/composition-api';
2225
import { useCache, CacheTagPrefix } from '@vue-storefront/cache';
2326
import type { MetaInfo } from 'vue-meta';
@@ -36,13 +39,20 @@ export default defineComponent({
3639
setup() {
3740
const { routeData } = usePageStore();
3841
const { addTags } = useCache();
39-
const { loadPage, loading } = useContent();
42+
const { error: nuxtError } = useContext();
43+
const {
44+
loadPage,
45+
loading,
46+
error,
47+
} = useContent();
4048
4149
const page = ref<CmsPage | null>(null);
4250
4351
useFetch(async () => {
4452
page.value = await loadPage({ identifier: routeData.identifier });
4553
54+
if (error?.value?.page || !page.value) nuxtError({ statusCode: 404 });
55+
4656
addTags([{ prefix: CacheTagPrefix.View, value: routeData.identifier }]);
4757
});
4858
return {

0 commit comments

Comments
 (0)