Fix customer dashboard

This commit is contained in:
Anthony Janin 2025-08-11 17:28:22 +02:00
parent 337db2f078
commit 941fff9ac7

View File

@ -22,6 +22,7 @@ import UserStore from "@Front/Stores/UserStore";
import AuthModal from "src/sdk/AuthModal";
import CustomerService from "src/common/Api/LeCoffreApi/sdk/CustomerService";
import MessageBus from "src/sdk/MessageBus";
import { resolve } from "path";
export enum LoginStep {
EMAIL,
@ -274,6 +275,11 @@ export default function Login() {
MessageBus.getInstance().initMessageListener();
MessageBus.getInstance().isReady().then(async () => {
try {
// Find the customer
const customer: any = (await CustomerService.getCustomers())
.map((process: any) => process.processData)
.find((customer: any) => customer.contact.email === email);
// Get the pairing ID
const pairingId = await MessageBus.getInstance().getPairingId();
console.log('[Login] Got pairing ID:', pairingId);
@ -287,7 +293,7 @@ export default function Login() {
if (targetProcess) {
console.log('[Login] Found target process:', targetProcess);
// Connect the user with the process data
UserStore.instance.connect(targetProcess);
UserStore.instance.connect(customer /*targetProcess*/);
router.push(Module.getInstance().get().modules.pages.Folder.pages.Select.props.path);
} else {
console.error('[Login] No process found for pairing ID:', pairingId);