Skip to content

Commit

Permalink
Merge branch 'FR-14866-entitlements-type-bugfix' into FR-14228-step-u…
Browse files Browse the repository at this point in the history
…p-vue3-without-fallback
  • Loading branch information
doregg committed Jan 14, 2024
2 parents 13fd20d + 54e97cf commit 7a63a19
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vue/src/auth/entitlements.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-ignore
import { inject, computed } from 'vue';
import { inject, computed, ComputedRef } from 'vue';
import { EntitledToOptions, Entitlement, CustomAttributes, Attributes, JwtAttributes } from '@frontegg/types';

import {
Expand Down Expand Up @@ -57,7 +57,7 @@ const useEntitlementsQueryData = (customAttributes?: CustomAttributes) => {
@returns if the user is entitled to the given feature. Attaching the justification if not
@throws when entitlement is not enabled via frontegg options
*/
export const useFeatureEntitlements = (key: string, customAttributes?: CustomAttributes): Entitlement => {
export const useFeatureEntitlements = (key: string, customAttributes?: CustomAttributes): ComputedRef<Entitlement> => {
return computed(() => {
const { entitlements, attributes, isV2 } = useEntitlementsQueryData(customAttributes);
return getFeatureEntitlements(entitlements, key, attributes, isV2)
Expand All @@ -70,7 +70,7 @@ export const useFeatureEntitlements = (key: string, customAttributes?: CustomAtt
@returns if the user is entitled to the given permission. Attaching the justification if not
@throws when entitlement is not enabled via frontegg options
*/
export const usePermissionEntitlements = (key: string, customAttributes?: CustomAttributes): Entitlement => {
export const usePermissionEntitlements = (key: string, customAttributes?: CustomAttributes): ComputedRef<Entitlement> => {
return computed(() => {
const { entitlements, attributes, isV2 } = useEntitlementsQueryData(customAttributes);
return getPermissionEntitlements(entitlements, key, attributes, isV2)
Expand All @@ -83,7 +83,7 @@ export const usePermissionEntitlements = (key: string, customAttributes?: Custom
@returns if the user is entitled to the given permission or feature. Attaching the justification if not
@throws when entitlement is not enabled via frontegg options
*/
export const useEntitlements = (entitledToOptions: EntitledToOptions, customAttributes?: CustomAttributes): Entitlement => {
export const useEntitlements = (entitledToOptions: EntitledToOptions, customAttributes?: CustomAttributes): ComputedRef<Entitlement> => {
return computed(() => {
const { entitlements, attributes, isV2 } = useEntitlementsQueryData(customAttributes);
return getEntitlements(entitlements as any, entitledToOptions, attributes, isV2)
Expand Down

0 comments on commit 7a63a19

Please sign in to comment.