response was erroneously passed to the swapP function in credential.js