Handling undefined Error with useDocument composable and routing in Nuxt App #1494
              
                Unanswered
              
          
                  
                    
                      dosstx
                    
                  
                
                  asked this question in
                Questions and Help
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am creating an app that lets users generate short stories. If the user wants to generate more than 5 stories, they will need to subscribe for a
premiumsubscription. I use custom claims to set the user subscription status and then set the number of stories the user has generated on the user's user document in Firestore. This process seems to work fine, however, I seem to have an issue with routing and using theuseDocumentVuefire composable and looking for advice on how to handle this situation:When user clicks a submit handler on the homepage (the
StoryInputcomponent) , I get amundefinederror:I think this is due to the state of the user document being queried?
Here's my Nuxt code for context:
/components/StoryInput.vue:/pages/story.vue:Side note, I do have the
story.vuepage set tossr: falsein Nuxt Config.Looking for advice on how to handle this case. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions