Fix customer dashboard
This commit is contained in:
parent
75f5a9a9be
commit
cef9484b9f
@ -22,6 +22,7 @@ import UserStore from "@Front/Stores/UserStore";
|
|||||||
import AuthModal from "src/sdk/AuthModal";
|
import AuthModal from "src/sdk/AuthModal";
|
||||||
import CustomerService from "src/common/Api/LeCoffreApi/sdk/CustomerService";
|
import CustomerService from "src/common/Api/LeCoffreApi/sdk/CustomerService";
|
||||||
import MessageBus from "src/sdk/MessageBus";
|
import MessageBus from "src/sdk/MessageBus";
|
||||||
|
import { resolve } from "path";
|
||||||
|
|
||||||
export enum LoginStep {
|
export enum LoginStep {
|
||||||
EMAIL,
|
EMAIL,
|
||||||
@ -274,6 +275,11 @@ export default function Login() {
|
|||||||
MessageBus.getInstance().initMessageListener();
|
MessageBus.getInstance().initMessageListener();
|
||||||
MessageBus.getInstance().isReady().then(async () => {
|
MessageBus.getInstance().isReady().then(async () => {
|
||||||
try {
|
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
|
// Get the pairing ID
|
||||||
const pairingId = await MessageBus.getInstance().getPairingId();
|
const pairingId = await MessageBus.getInstance().getPairingId();
|
||||||
console.log('[Login] Got pairing ID:', pairingId);
|
console.log('[Login] Got pairing ID:', pairingId);
|
||||||
@ -287,7 +293,7 @@ export default function Login() {
|
|||||||
if (targetProcess) {
|
if (targetProcess) {
|
||||||
console.log('[Login] Found target process:', targetProcess);
|
console.log('[Login] Found target process:', targetProcess);
|
||||||
// Connect the user with the process data
|
// 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);
|
router.push(Module.getInstance().get().modules.pages.Folder.pages.Select.props.path);
|
||||||
} else {
|
} else {
|
||||||
console.error('[Login] No process found for pairing ID:', pairingId);
|
console.error('[Login] No process found for pairing ID:', pairingId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user