Skip to content

Commit

Permalink
RN-903 Prefix QR code (#4783)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorNadj authored Jul 25, 2023
1 parent 2d5cdcf commit a6de39c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/admin-panel/src/pages/resources/EntitiesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const COLUMNS = [
actionConfig: {
qrCodeContentsKey: 'id',
humanReadableIdKey: 'code',
qrCodePrefix: 'entity-',
},
},
];
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-panel/src/table/columnTypes/QrCodeButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ QrCodeButtonComponent.propTypes = {
const mapDispatchToProps = (dispatch, ownProps) => ({
openModal: () => {
const { row, actionConfig } = ownProps;
const { qrCodeContentsKey, humanReadableIdKey } = actionConfig;
const { qrCodeContentsKey, humanReadableIdKey, qrCodePrefix } = actionConfig;
if (!qrCodeContentsKey || !humanReadableIdKey) {
throw new Error(
'QR code button misconfigured. Must specify qrCodeContentsKey and humanReadableIdKey',
);
}
const qrCodeContents = row[qrCodeContentsKey];
const humanReadableId = row[humanReadableIdKey];
dispatch(openQrCodeModal(qrCodeContents, humanReadableId));
dispatch(openQrCodeModal(`${qrCodePrefix}${qrCodeContents}`, humanReadableId));
},
});

Expand Down

0 comments on commit a6de39c

Please sign in to comment.