Skip to content

What is the best pattern for this Vue/Pinia scenario? #10191

Discussion options

You must be logged in to vote

In your TaskItem.vue component, I don't see any issues with the code initially. If you want to handle the error in a more detailed way, you can examine the error code:

catch(error) {
  switch (error.code) {
    case 'permission-denied':
      toast.error('Permission denied, contact support...');
      break;
    case 'unauthenticated':
      //....
      break;
    case 'not-found':
      //....
      break;
    // Add more cases as needed
    default:
      //....
  }
}

For more error codes, refer to:
Firebase Doc

I also noticed that in your 'task.js' Store, you are placing the database logic, which I don't consider a good practice to have Firebase functions within the state manager. I p…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pedrodruviaro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants