I have tried to achieve this using answer from the question here Magento 2 : Add to cart button change to go to cart after adding product
However the button text is not changed immediately as the code is from phtml file and not js file.
I wish to achieve this using js(catalog-add-to-cart.js). To check if product is added to cart, I need to get cart items in this file. How do I get current user cart items here? Once the text is changed to Go to Cart, I also want to change the button link to cart url.