yangc 8 år sedan
förälder
incheckning
1441656464
2 ändrade filer med 20 tillägg och 6 borttagningar
  1. 9 0
      pages/error/index.vue
  2. 11 6
      pages/store/_uuid/index.vue

+ 9 - 0
pages/error/index.vue

@@ -0,0 +1,9 @@
+<template>
+  <div id="error">404</div>
+</template>
+<script>
+  export default {
+    name: 'error',
+    layout: 'error'
+  }
+</script>

+ 11 - 6
pages/store/_uuid/index.vue

@@ -15,12 +15,17 @@ export default {
       uuid: this.$route.params.uuid
     }
   },
-  fetch ({ store, params }) {
-    return Promise.all([
-      store.dispatch('shop/findStoreInfoFromUuid', params),
-      store.dispatch('shop/findRecommendProducts', params),
-      store.dispatch('shop/pageCommoditiesOfStore', params.uuid, { page: 1, count: 6 })
-    ])
+  fetch ({ store, params, redirect }) {
+    if (!params.uuid) {
+      return redirect('/error')
+    }
+    if (params.uuid && params.uuid !== '') {
+      return Promise.all([
+        store.dispatch('shop/findStoreInfoFromUuid', params),
+        store.dispatch('shop/findRecommendProducts', params),
+        store.dispatch('shop/pageCommoditiesOfStore', params.uuid, { page: 1, count: 6 })
+      ])
+    }
   },
   async asyncData ({ params }) {
 //  asyncData ({ params }) {