Replies: 1 comment
-
@EskiMojo14 @markerikson, can u please help me with this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I have a question regarding drilling a property from a query or mutation to the prepareHeaders function.
I have two types of tokens, and I need to add them to the request only under specific conditions.
Currently, I have two solutions. The first one involves creating a condition inside the prepareHeaders function based on the endpoint name. However, this approach is unsafe because the name could be changed, and I cannot keep it as a variable.
The second solution is to pass a custom header from the endpoint and retrieve it in the prepareHeaders function. Then, a condition can be made based on this header value. This approach is safer as I can use a variable, but it still seems like a suboptimal solution.
So, the main question is: Is there a better way to extract a property from the endpoint to the prepareHeaders function?
solution1:
solution2:
Beta Was this translation helpful? Give feedback.
All reactions