Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1008

Merged
merged 1 commit into from
Jun 19, 2023
Merged

fix #1008

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions ui_src/src/components/sdkExsample/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ const SdkExample = ({ consumer, showTabs = true, stationName, username, connecti
codeEx.consumer = codeEx.consumer?.replaceAll('<memphis-host>', host);
codeEx.producer = codeEx.producer?.replaceAll('<station-name>', stationName);
codeEx.consumer = codeEx.consumer?.replaceAll('<station-name>', stationName);
codeEx.producer = codeEx.producer?.replaceAll('<account-id>', localStorage.getItem(LOCAL_STORAGE_ACCOUNT_ID));
codeEx.consumer = codeEx.consumer?.replaceAll('<account-id>', localStorage.getItem(LOCAL_STORAGE_ACCOUNT_ID));
codeEx.producer = codeEx.producer?.replaceAll(`'<account-id>'`, parseInt(localStorage.getItem(LOCAL_STORAGE_ACCOUNT_ID)));
codeEx.consumer = codeEx.consumer?.replaceAll(`'<account-id>'`, parseInt(localStorage.getItem(LOCAL_STORAGE_ACCOUNT_ID)));
codeEx.producer = codeEx.producer?.replaceAll(`"<account-id>"`, parseInt(localStorage.getItem(LOCAL_STORAGE_ACCOUNT_ID)));
codeEx.consumer = codeEx.consumer?.replaceAll(`"<account-id>"`, parseInt(localStorage.getItem(LOCAL_STORAGE_ACCOUNT_ID)));
if (username) {
codeEx.producer = codeEx.producer?.replaceAll('<application type username>', username);
codeEx.consumer = codeEx.consumer?.replaceAll('<application type username>', username);
Expand All @@ -90,17 +92,17 @@ const SdkExample = ({ consumer, showTabs = true, stationName, username, connecti
codeEx.producer = codeEx.producer?.replaceAll('<broker-token>', '<password>');
codeEx.consumer = codeEx.consumer?.replaceAll('<broker-token>', '<password>');
} else {
const accountId = localStorage.getItem(LOCAL_STORAGE_ACCOUNT_ID)
const regexPatternGo = `, memphis\.AccountId\("${accountId}"\)`;
const accountId = parseInt(localStorage.getItem(LOCAL_STORAGE_ACCOUNT_ID))
const regexPatternGo = `, memphis\.AccountId\(${accountId}\)`;
codeEx.producer = codeEx.producer?.replaceAll(regexPatternGo, "");
codeEx.consumer = codeEx.consumer?.replaceAll(regexPatternGo, "");
const regexPatternJs = `accountId: '${accountId}'`;
const regexPatternJs = `accountId: ${accountId}`;
codeEx.producer = codeEx.producer?.replaceAll(regexPatternJs, "");
codeEx.consumer = codeEx.consumer?.replaceAll(regexPatternJs, "");
codeEx.producer = codeEx.producer?.replaceAll(regexPatternJs, "");
codeEx.consumer = codeEx.consumer?.replaceAll(regexPatternJs, "");

const regexPatternPython = `, account_id="${accountId}"`;
const regexPatternPython = `, account_id=${accountId}`;
codeEx.producer = codeEx.producer?.replaceAll(regexPatternPython, "");
codeEx.consumer = codeEx.consumer?.replaceAll(regexPatternPython, "");
}
Expand Down