Pair device right away to prevent errors on prd update operations

This commit is contained in:
Sosthene 2025-09-03 15:11:07 +02:00
parent 80dc42bbe6
commit e320cfa193

View File

@ -366,15 +366,14 @@ export class Server {
if (!processId || !stateId) { if (!processId || !stateId) {
throw new Error('Failed to get process id or state id'); throw new Error('Failed to get process id or state id');
} }
// now pair the device before continuing
service.pairDevice(processId, [service.getDeviceAddress()]);
await service.handleApiReturn(pairingResult); await service.handleApiReturn(pairingResult);
const udpateResult = await service.createPrdUpdate(processId, stateId); const udpateResult = await service.createPrdUpdate(processId, stateId);
await service.handleApiReturn(udpateResult); await service.handleApiReturn(udpateResult);
const approveResult = await service.approveChange(processId, stateId); const approveResult = await service.approveChange(processId, stateId);
await service.handleApiReturn(approveResult); await service.handleApiReturn(approveResult);
// now pair the device
service.pairDevice(processId, [service.getDeviceAddress()]);
// Update the device in the database // Update the device in the database
const device = service.dumpDeviceFromMemory(); const device = service.dumpDeviceFromMemory();
if (device) { if (device) {