File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
src/components/Extensibility/helpers Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,7 @@ import { isEqual } from 'lodash';
44import { getReadableTimestamp } from 'shared/components/ReadableCreationTimestamp/ReadableCreationTimestamp' ;
55import { doesUserHavePermission } from 'state/navigation/filters/permissions' ;
66import { permissionSetsSelector } from 'state/permissionSetsSelector' ;
7- import { jwtDecode } from 'jwt-decode' ;
8- import { AuthDataState , authDataState } from 'state/authDataAtom' ;
7+ import { useCheckSAPUser } from 'hooks/useCheckSAPUser' ;
98
109/*
1110 Turns jsonata expressions like
@@ -95,17 +94,8 @@ export function jsonataWrapper(expression: string) {
9594 } ) ;
9695
9796 exp . registerFunction ( 'isSAPuser' , ( ) => {
98- const authData : AuthDataState = useRecoilValue ( authDataState ) ;
99- try {
100- if ( authData && 'token' in authData ) {
101- const decoded = jwtDecode ( authData ?. token ) ;
102- return decoded ?. sub ?. includes ( '@sap.com' ) ;
103- }
104- } catch ( error ) {
105- console . error ( 'Error while checking if user is SAP user' , error ) ;
106- return false ;
107- }
108- return false ;
97+ const isSAPUser = useCheckSAPUser ( ) ;
98+ return isSAPUser ;
10999 } ) ;
110100
111101 return exp ;
You can’t perform that action at this time.
0 commit comments