Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

myModule/fetchById issue? #339

Open
moreorover opened this issue May 25, 2020 · 2 comments
Open

myModule/fetchById issue? #339

moreorover opened this issue May 25, 2020 · 2 comments

Comments

@moreorover
Copy link

Hello all,

I'm currently trying to fetch a document by its ID. Everything works great if the id exists in the collection, however, if document does not exist with given ID the promise does not proc the catch clause on the function.

trying to fetch document by its id:

{
      path: "/supplier/:id",
      name: "Supplier Show",
      component: () => import("../views/SupplierShow.vue"),
      props: true,
      beforeEnter(routeTo, routeFrom, next) {
        store
          .dispatch("suppliersModule/fetchById", routeTo.params.id)
          .then(supplier => {
            routeTo.params.supplier = supplier;
            next();
          })
          .catch(error => {
            console.log("catch");
            console.log(error);
            next({ name: "404", params: { resource: error.toString() } });
          });
      }
    },

Console shows the following:
image

Shouldn't invalid ID proc the catch clause so the router could reroute to the error page? I have tried capturing the error, however, the code breaks within vuex-easy-firestore code.

Note. Logging mode disabled. When enabled, then returns a string indicating an issue that it couldn't find a document with a given ID.

@mesqueeb
Copy link
Owner

will look into this soon, sorry for the wait!

@moreorover
Copy link
Author

please check pull request #340

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants