From d7ccde30ee3c3559fc31efcb84d56e577f51877d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 13 Oct 2022 09:22:49 +0200 Subject: [PATCH] feat: add getLayout to return type of withAuthorization (#82) --- src/app-bridge/with-authorization.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app-bridge/with-authorization.tsx b/src/app-bridge/with-authorization.tsx index e087ab5..eeae84e 100644 --- a/src/app-bridge/with-authorization.tsx +++ b/src/app-bridge/with-authorization.tsx @@ -27,6 +27,10 @@ const defaultProps: Props = { unmounted:

Loading

, }; +type WithAuthorizationHOC

= React.FunctionComponent

& { + getLayout?: (page: React.ReactElement) => React.ReactNode; +}; + /** * Most likely, views from your app will be only accessibly inside Dashboard iframe. * This HOC can be used to handle all checks, with default messages included. @@ -38,7 +42,7 @@ export const withAuthorization = (props: Props = defaultProps) => >( BaseComponent: React.FunctionComponent - ) => { + ): WithAuthorizationHOC => { const { dashboardTokenInvalid, noDashboardToken, notIframe, unmounted } = { ...defaultProps, ...props, @@ -67,5 +71,5 @@ export const withAuthorization = return ; } - return AuthorizedPage; + return AuthorizedPage as WithAuthorizationHOC; };