test: reduce branching in authenticator

This commit is contained in:
Randall Morey committed 2020-10-03 11:08:50 -04:00
1 parent cd6b8694fd
commit 4267839b96
1 file changed
+2 -2
+2 -2
View File
@@ -63,7 +63,7 @@ export default class PasswordAuthenticator extends BasePasswordAuthenticator {
authenticate() {
return super.authenticate(...arguments).then((data) => {
const token = data?.token;
if (token) this.addTokenToAuthorization(token);
this.addTokenToAuthorization(token);
return data;
});
}
@@ -93,6 +93,6 @@ export default class PasswordAuthenticator extends BasePasswordAuthenticator {
const headers = adapterPrototype?.headers;
if (!headers) adapterPrototype.headers = {};
adapterPrototype.headers.Authorization = null;
if (token) adapterPrototype.headers.Authorization = `Bearer ${token}`;
adapterPrototype.headers.Authorization = `Bearer ${token}`;
}
}