Is there any particular reason why you are fetching a user’s active plan from the backend? Your code is visually hard to debug since you haven’t formatted it correctly using the </> button.
Refer to my code in this post that returns a list of all active pricing plan orders placed by a user, without using any backend code:
In the above example, the code returns "ACTIVE" or "NA" depending on the subscription status. This will make it much easier for you to enable / disable buttons and other elements all from the frontend itself based on the result of the function.