جواد قاسمی
5 سال پیش توسط جواد قاسمی مطرح شد
0 پاسخ

مشکل با bind کردن this

سلام به همه دوستان
من برای ی کاری اومدم از Promise.all اینطوری استفاده کردم

 await Promise.all(
            [
                signupController.signUpToEmployeeService(request)
                    .then(response => dataRollback.push(rollbackController.employeeServiceRollback))
                    .catch(err => dataErrors.push('EmployeeService error: ' + err)),
                signupController.signUpToAuthenticationService.bind(self, request)
                    .then(response => dataRollback.push(rollbackController.authenticationServiceRollback.bind(self)))
                    .catch(err => dataErrors.push('AuthenticationService error: ' + err)),
                signupController.signUpToProfileService(request).bind(self)
                    .then(response => dataRollback.push(rollbackController.ProfileServiceRollback.bind(self)))
                    .catch(err => dataErrors.push('ProfileService error: ' + err)),
                signupController.signUpToSamadService(request)
                    .then(response => dataRollback.push(rollbackController.samadServiceRollback.bind(self)))
                    .catch(err => dataErrors.push('SamadService error: ' + err)),
            ]
        );

اومدم برای فرستادن this به اون فانکشن از bind(this, request) استفاده کردم.
اما این اررور رو میده:
TypeError: signupController.signUpToAuthenticationService.bind(...).then is not a function