Skip to content

Commit 692a5d4

Browse files
committed
Move authentication checkout outside of app
1 parent 75836b6 commit 692a5d4

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

build/static/js/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/static/js/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77
<title>ACCESS Q&A Bot Demo</title>
88
<link rel="stylesheet" href="./build/static/css/main.css">
99
</head>
10-
<body>
10+
<body class="user-logged-in">
1111
<div class="embedded-qa-bot" data-welcome="Hello! What can I help you with?" data-prompt="Ask me about ACCESS!"></div>
1212
<div id="qa-bot"></div>
1313

14+
<script>
15+
function isAnonymous() {
16+
return !document.querySelector('body').classList.contains('user-logged-in');
17+
}
18+
window.isAnonymous = isAnonymous();
19+
</script>
1420
<script src="./build/static/js/main.js"></script>
1521
<script src="./build/static/js/453.chunk.js"></script>
1622

src/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ import reportWebVitals from './reportWebVitals';
88
const domNode = document.createElement('div');
99
const root = ReactDOM.createRoot(domNode);
1010

11-
function isAnonymous() {
12-
return !document.querySelector('body').classList.contains('user-logged-in');
13-
}
14-
const disabled = isAnonymous();
11+
const disabled = window.isAnonymous;
1512

1613
root.render(
1714
<React.StrictMode>
@@ -23,7 +20,6 @@ document.body.appendChild(domNode);
2320
// Look for optional elements for an embedded chat widget
2421
const embeddedQABots = document.querySelectorAll('.embedded-qa-bot');
2522
embeddedQABots.forEach(embeddedQABot => {
26-
const disabled = isAnonymous();
2723
// welcome message and prompt are data- attributes
2824
const welcome = embeddedQABot.dataset.welcome;
2925
const prompt = embeddedQABot.dataset.prompt;

0 commit comments

Comments
 (0)