Checking if the code has already been received so that we don't go into an infinite loop of sending post request and receiving response