File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1717<script lang="ts">
1818import { SfLoader , SfHeading } from ' @storefront-ui/vue' ;
1919import {
20- defineComponent , ref , useFetch ,
20+ defineComponent ,
21+ ref ,
22+ useFetch ,
23+ useContext ,
2124} from ' @nuxtjs/composition-api' ;
2225import { useCache , CacheTagPrefix } from ' @vue-storefront/cache' ;
2326import 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 {
You can’t perform that action at this time.
0 commit comments