Fix customer user not being properly associated with session #730

This commit is contained in:
Ramon Gutierrez 2023-06-14 16:49:04 +08:00
parent c4878a9e6d
commit 31c0f4a102

View file

@ -173,6 +173,8 @@ class AuthController extends ApiController
}
if (!$customer_user) {
error_log("We don't have a customer user for session " . $this->session->getID());
$customer_user = $this->findCustomerUserByNumber($this->session->getPhoneNumber());
if ($customer_user === null) {
@ -183,15 +185,17 @@ class AuthController extends ApiController
// save
$this->em->persist($customer_user);
$this->em->flush();
} else {
error_log("Found existing customer user for " . $this->session->getPhoneNumber());
}
}
$this->em->flush();
error_log("Customer user ID is " . $customer_user->getID());
// set session customer user
$this->session->setCustomerUser($customer_user);
$this->em->flush();
// response
return new ApiResponse(true, '', [