feat: 🎸 add org nav to header
This commit is contained in:
6 files changed
+51
-12
No files matched your search
@@ -64,7 +64,7 @@ export default class PasswordAuthenticator extends BaseAuthenticator {
|
||||
case 404:
|
||||
return reject();
|
||||
}
|
||||
return resolve(data);
|
||||
return resolve(this.normalizeData(data));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,20 @@ export default class PasswordAuthenticator extends BaseAuthenticator {
|
||||
const authEndpointURL = this.buildAuthEndpointURL(options);
|
||||
const response = await fetch(authEndpointURL, { method: 'post', body });
|
||||
const json = await response.json();
|
||||
return response.status < 400 ? resolve(json) : reject();
|
||||
return response.status < 400 ? resolve(this.normalizeData(json)) : reject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes the auth data. Adds convenience booleans depending on the
|
||||
* scope within which the session is authenticated: isGlobal, isOrg.
|
||||
* @param {object} data
|
||||
* @return {object}
|
||||
*/
|
||||
normalizeData(data) {
|
||||
// Add booleans indicated the scope type
|
||||
data.isGlobal = (data?.scope?.type === 'global');
|
||||
data.isOrg = (data?.scope?.type === 'org');
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user