The below refactored code doesn\'t wait for the API request. Value 1 and Value 2 are the values keyed in by me in the application and I have to wait for the API request but