Adding helper for auth key resolution

This commit is contained in:
Peter Morton 2023-10-11 19:20:46 -05:00
parent bee026efd8
commit 5c802c8e4e

12
src/helpers/index.js Normal file
View File

@ -0,0 +1,12 @@
export function getAuthKeyFromProperties(props) {
var authKey;
if (props.sessionIdentifier && props.sessionIdentifier.length > 0) {
authKey = props.sessionIdentifier;
} else if (props.username && props.username.length > 0) {
authKey = props.username;
} else {
throw new Error('_sessionIdentifier or username properties not found (check query params)');
}
return authKey
}