Skip to content

Commit

Permalink
util,console: Fix claiming issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kschiffer committed Jun 22, 2023
1 parent 40f1d10 commit ee161bf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ For details about compatibility between different releases, see the **Commitment
### Fixed

- Fix payload formatter page launching malformed requests in the Console.
- Fix end device claiming issues in the Console and improve error messaging.

### Security

Expand Down
8 changes: 8 additions & 0 deletions pkg/webui/console/containers/device-onboarding-form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ const DeviceOnboardingForm = () => {
delete mac_state.current_parameters
}

if (values.authenticated_identifiers) {
cleanedValues.ids = {
...cleanedValues.ids,
...values.authenticated_identifiers,
device_id: values.target_device_id,
}
}

const endDevice = await dispatch(attachPromise(createDevice(appId, cleanedValues)))
switch (_registration) {
case REGISTRATION_TYPES.MULTIPLE:
Expand Down
10 changes: 3 additions & 7 deletions sdk/js/src/service/devices/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ class Devices {

// Initiate claiming, if the device is claimable.
const hasAuthenticatedIdentifiers = Boolean(authenticated_identifiers)
const claimInfoResponse = await this._api.EndDeviceClaimingServer.GetInfoByJoinEUI({
const claimInfoResponse = await this._api.EndDeviceClaimingServer.GetInfoByJoinEUI(undefined, {
join_eui: ids.join_eui,
})
const claim = Marshaler.payloadSingleResponse(claimInfoResponse)
Expand Down Expand Up @@ -521,12 +521,8 @@ class Devices {
application_id: applicationId,
},
}
try {
const claimResponse = await this._api.EndDeviceClaimingServer.Claim(undefined, claimPayload)
claimDeviceIds = Marshaler.payloadSingleResponse(claimResponse)
} catch (error) {
throw new Error('Unable to claim end device', { cause: error })
}
const claimResponse = await this._api.EndDeviceClaimingServer.Claim(undefined, claimPayload)
claimDeviceIds = Marshaler.payloadSingleResponse(claimResponse)
}

let newFieldmasks = mask
Expand Down

0 comments on commit ee161bf

Please sign in to comment.