modified js to api-login