protect routes and import function
This commit is contained in:
1 parent
e600f293b0
commit
f476a57748
12 files changed
+112
-28
No files matched your search
@@ -152,7 +152,6 @@ export const addUserContext = async (
|
||||
const provider = EntitlementsFactory.create();
|
||||
const entitlements: Entitlements = await provider.getForOrg(orgId);
|
||||
req.entitlements = entitlements;
|
||||
|
||||
return next();
|
||||
} catch (error) {
|
||||
next(error);
|
||||
|
||||
@@ -11,7 +11,7 @@ type NumberKeys<T> = {
|
||||
}[keyof T];
|
||||
|
||||
const getEntitlements = (req: Request): Entitlements | undefined => {
|
||||
return (req as any).entitlements as Entitlements | undefined;
|
||||
return req.entitlements;
|
||||
};
|
||||
|
||||
export const requireFeature = (flag: BooleanKeys<Entitlements>) => {
|
||||
|
||||
Reference in new issue
Block a user