Make small code style improvements
This commit is contained in:
parent
d178be7576
commit
da17e4ee8a
3 changed files with 4 additions and 16 deletions
|
@ -61,9 +61,7 @@ class ConnectionManager {
|
|||
const { connectionId } = subscription;
|
||||
const added = !this.connections.get(connectionId);
|
||||
if (added) {
|
||||
const { baseUrl } = subscription;
|
||||
const { topic } = subscription;
|
||||
const { user } = subscription;
|
||||
const { baseUrl, topic, user } = subscription;
|
||||
const since = subscription.last;
|
||||
const connection = new Connection(
|
||||
connectionId,
|
||||
|
|
|
@ -118,10 +118,10 @@ export const maybeWithBearerAuth = (headers, token) => {
|
|||
export const withBasicAuth = (headers, username, password) => ({ ...headers, Authorization: basicAuth(username, password) });
|
||||
|
||||
export const maybeWithAuth = (headers, user) => {
|
||||
if (user && user.password) {
|
||||
if (user?.password) {
|
||||
return withBasicAuth(headers, user.username, user.password);
|
||||
}
|
||||
if (user && user.token) {
|
||||
if (user?.token) {
|
||||
return withBearerAuth(headers, user.token);
|
||||
}
|
||||
return headers;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue