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 and Rohan Port committed Jul 30, 2023
1 parent af1b0f8 commit 9e19bed
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 9e19bed

Please sign in to comment.