Skip to content

Intercept the user endpoint response #194

Answered by manchenkoff
tiagomatosweb asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @tiagomatosweb, there are two options depending on what you actually want to achieve:

  1. useSanctumUser is a generic composable, so you can type it with a specific type/interface and your IDE will do the rest. However, you can still access other object properties even if they are not highlighted in the code. You can check example in the docs
  2. You can create your custom global interceptor for ofetch onResponse and check if the request is your endpoints.user, then try to change response object. However, I never tried doing so, not sure how ofetch handles it. You can check another example in the docs as well

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by manchenkoff
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #193 on October 02, 2024 23:41.