change login and register to api