made ApiService.login() use promises instead of callbacks