This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type HOCPropInjector<InjectedProps = {}> = <OwnProps>( | |
| Component: React.FC<OwnProps> | React.ComponentClass<OwnProps, {}> | |
| ) => React.FC<OwnProps & Omit<OwnProps, keyof InjectedProps>> | |
| type CollectProps<ReturnProps, TParam> = ( | |
| injectorParam: TParam, | |
| props: any | |
| ) => ReturnProps | |
| type HOCFunctionWrapper<Param, InjectedProps = {}> = <CollectedProps>( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import PropTypes from 'prop-types'; | |
| import ReactDOM from 'react-dom'; | |
| const isReact16 = ReactDOM.createPortal !== undefined; | |
| export default class Portal extends React.Component { | |
| static propTypes = { | |
| children: PropTypes.node, | |
| show: PropTypes.bool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| After reading about all the issues loobackContext.getCurrentContext() I was getting concerned. | |
| In my experience with role resolvers, the AccessContext is not vulnerable to the same issues of dropping context. | |
| My thinking was to grab the currentUser from the AccessConext in a roleResovler and set it on the instance | |
| which would then be accessable in the operation hooks without have to use loopback-context. More testing needed. | |
| **/ | |
| // register role resolver | |
| Role.registerResolver( 'currentUser', function( role, context, cb ) { | |
| var currentUser; |