Skip to content

Commit

Permalink
console: Move EUI transformation to SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
KrishnaIyer committed Jul 10, 2023
1 parent f5055d9 commit 695f2d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pkg/webui/console/views/device-general-settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
selectNsConfig,
} from '@ttn-lw/lib/selectors/env'

import { hexToBase64 } from '@console/lib/bytes'
import {
mayEditApplicationDeviceKeys,
mayReadApplicationDeviceKeys,
Expand Down Expand Up @@ -102,7 +101,7 @@ const DeviceGeneralSettings = () => {
ids: { dev_eui: devEui, join_eui: joinEui },
} = device
await dispatch(
attachPromise(unclaimDevice(appId, devId, hexToBase64(devEui), hexToBase64(joinEui))),
attachPromise(unclaimDevice(appId, devId, devEui, joinEui)),
)
}, [appId, devId, device, dispatch])

Expand Down
6 changes: 4 additions & 2 deletions sdk/js/src/service/claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import autoBind from 'auto-bind'

import Marshaler from '../util/marshaler'

import { hexToBase64 } from '@console/lib/bytes'

class DeviceClaim {
constructor(registry, { stackConfig }) {
this._api = registry
Expand Down Expand Up @@ -62,8 +64,8 @@ class DeviceClaim {
}

const response = await this._api.EndDeviceClaimingServer.Unclaim(params, {
dev_eui: devEui,
join_eui: joinEui,
dev_eui: hexToBase64(devEui),
join_eui: hexToBase64(joinEui),
})

return Marshaler.payloadSingleResponse(response)
Expand Down

0 comments on commit 695f2d9

Please sign in to comment.