@openstax/ts-utils 1.35.0 → 1.35.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/services/authProvider/index.d.ts +1 -1
- package/dist/cjs/services/authProvider/utils/userRoleValidator.js +2 -2
- package/dist/cjs/tsconfig.without-specs.cjs.tsbuildinfo +1 -1
- package/dist/esm/services/authProvider/index.d.ts +1 -1
- package/dist/esm/services/authProvider/utils/userRoleValidator.js +2 -2
- package/dist/esm/tsconfig.without-specs.esm.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -38,7 +38,7 @@ export type ApiUser = TokenUser & {
|
|
|
38
38
|
export type User = TokenUser | ApiUser;
|
|
39
39
|
export type AuthProvider = {
|
|
40
40
|
getAuthToken: () => Promise<string | null>;
|
|
41
|
-
getUser: () => Promise<
|
|
41
|
+
getUser: () => Promise<TokenUser | undefined>;
|
|
42
42
|
/**
|
|
43
43
|
* gets second argument for `fetch` that has authentication token or cookie
|
|
44
44
|
*/
|
|
@@ -9,9 +9,9 @@ const createUserRoleValidator = (auth, config) => {
|
|
|
9
9
|
const application = (0, helpers_1.once)(() => (0, resolveConfigValue_1.resolveConfigValue)(config.application));
|
|
10
10
|
const getUserRoles = async () => {
|
|
11
11
|
var _a;
|
|
12
|
-
const user = await auth.
|
|
12
|
+
const user = await auth.loadUserData();
|
|
13
13
|
const appName = await application();
|
|
14
|
-
if (!user
|
|
14
|
+
if (!user) {
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
17
|
return ((_a = user.applications.find(a => a.name === appName)) === null || _a === void 0 ? void 0 : _a.roles) || [];
|