From d18647230babb93ec16aa3e359c231c537a153f8 Mon Sep 17 00:00:00 2001 From: Pavel Sazukin Date: Wed, 21 Feb 2024 14:32:56 +0400 Subject: [PATCH] fix enabled toglle always false --- mocks/es/devices.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mocks/es/devices.ts b/mocks/es/devices.ts index 38c13ad..0f66779 100644 --- a/mocks/es/devices.ts +++ b/mocks/es/devices.ts @@ -12,7 +12,7 @@ export const transport = createRouterTransport(({ service }) => { const devicesByNs = new Map() const nodes = new Map() - function changeDevice (key: string, uuid: string, value?: any) { + function changeDevice(key: string, uuid: string, value?: any) { const device = devices.get(uuid) ?? new Device({ uuid }) if (value ?? true) value = !device[key] @@ -157,10 +157,10 @@ export const transport = createRouterTransport(({ service }) => { return new EmptyMessage() }, toggle(request) { - return new Device(changeDevice('enabled', request.uuid)) + return new Device(changeDevice('enabled', request.uuid, !request.enabled)) }, toggleBasic(request) { - return new Device(changeDevice('basicEnabled', request.uuid)) + return new Device(changeDevice('basicEnabled', request.uuid, !request.basicEnabled)) }, makeDevicesToken(request) { const token = Math.random().toString(16).slice(2)