Skip to content

Commit c54ade9

Browse files
authored
don't set bearer token for non-hypermode hosted graphs (#374)
1 parent 57fafad commit c54ade9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

client/src/components/ServerConnectionModal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export default function ServerConnectionModal() {
222222
}}
223223
>
224224
<Form.Group controlId="serverUrlInput">
225-
<Form.Label>Dgraph Conn String:</Form.Label>
225+
<Form.Label>Dgraph Connection String:</Form.Label>
226226
<Form.Control
227227
type="text"
228228
placeholder="https://dgraph.example.com:port"

client/src/reducers/connection.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ import {
5151
Unknown,
5252
} from "lib/constants";
5353

54+
const HYPERMODE_HOST_DOMAIN = "hypermode.host";
55+
const HYPERMODE_STAGE_HOST_DOMAIN = "hypermode-stage.host";
56+
5457
const assert = (test, message = "No message") => {
5558
if (!test) {
5659
throw new Error("Assertion Failed: " + message);
@@ -202,7 +205,12 @@ export default (state = defaultState, action) =>
202205
const newActiveServer = draft.serverHistory[0];
203206
newActiveServer.slashApiKey = action.slashApiKey;
204207
setCurrentServerUrl(newActiveServer.url);
205-
setCurrentServerSlashApiKey(newActiveServer.slashApiKey);
208+
if (
209+
action.url.endsWith(HYPERMODE_HOST_DOMAIN) ||
210+
action.url.endsWith(HYPERMODE_STAGE_HOST_DOMAIN)
211+
) {
212+
setCurrentServerSlashApiKey(newActiveServer.slashApiKey);
213+
}
206214
break;
207215
case SET_AUTH_TOKEN:
208216
assert(action.url, "This action requires url " + action.type);

0 commit comments

Comments
 (0)